Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Re^4: Idiomatic optimizations

by demerphq (Chancellor)
on May 02, 2002 at 13:13 UTC ( [id://163529]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $a=1;$b=2;$c=3;$d=4;$f=5;$g=6;$h=7;
    $foo = $a? $b? $c : $d? $e : $f : $g : $h;
    ...
    __END__
    syntax error at C:\temp\ternary.pl line 2, near "$g :"
    Execution of C:\temp\ternary.pl aborted due to compilation errors.
    
  2. or download this
    $foo = $a ? $b ? $c : $d ? $e : $f : $g;
    
  3. or download this
    $foo = !$a ? $g : $b ? $c : $d ? $e : $f;
    
  4. or download this
    $foo = !$a ? $g
               : $b ? $c
                    : $d ? $e
                         : $f;
    
  5. or download this
    $foo = $a ? ($b ? $c 
                    : ($d ? $e 
                          : $f)) 
              : $g;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://163529]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2024-04-23 11:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found