Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Loops and variable usage

by BillKSmith (Chaplain)
on Mar 24, 2012 at 23:09 UTC ( #961447=note: print w/ replies, xml ) Need Help??


in reply to Re: Loops and variable usage
in thread Loops and variable usage

I find nested ternaries are much clearer using the code layout suggested by the book "Perl Best Practices"

sub ddd { # code # value my $a = $_[0] == 1 ? 'p' : $_[0] == 2 ? 'pp' : $_[0] ; my $b = $_[1] == 3 ? 'w' : $_[1] ; my $c = $_[2]; print v " < $a > < $b > < $c >"; }


Comment on Re^2: Loops and variable usage
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2014-08-31 03:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls