Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Loops and variable usage

by BillKSmith (Priest)
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 >"; }

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 making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2016-09-28 18:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (536 votes). Check out past polls.