Re: really bad use of postfix



Ken Foskey wrote:
Just like to show how NOT to use postfix. I have had a frustrating day
tackling this type of unreadable code.

exec_rqst('stga2k_vps.pl',$FileNameIn) if ($a2kqual[4] eq
"VPS");
exec_rqst('stga2kif.sh',$FileNameIn) if ($a2kqual[4] ne
"VPS");


if ($a2kqual[4] eq "VPS") {
exec_rqst('stga2k_vps.pl',$FileNameIn);
}
else {
exec_rqst('stga2kif.sh',$FileNameIn);
}

How about this?

exec_rqst(
$a2kqual[ 4 ] eq 'VPS' ? 'stga2k_vps.pl' : 'stga2kif.sh',
$FileNameIn
);



John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
.



Relevant Pages

  • Re: Scientific Ruby (was Re: enterprise ruby)
    ... Ruby is the newest language in my toolbox, ... years behind R and ten years behind Perl. ... The other side of that coin, ...
    (comp.lang.ruby)
  • RE: Regex help
    ... Unless Perl is the only tool available to you in your toolbox and if you're running Linux or similar consider the "tr -s " command in a shell. ... However if you are strictly limited to Perl then this stand regex works:- ...
    (perl.beginners)
  • Re: Reasons for preferring Lisp, and for what
    ... > programmer than the language if he chooses to write unreadable code (for ... Why is `executable Perl linenoise' so often bemoaned? ...
    (comp.lang.lisp)
  • Re: Converting to capital only one word in a line
    ... The terminating delimiter is missing. ... Perl isn't a toolbox, but a small machine shop where you can special-order ...
    (perl.beginners)
  • Re: Conditional operator
    ... "@name, $sid, SIR Fall 2007"; ... Perl isn't a toolbox, but a small machine shop where you can special-order ...
    (perl.beginners)