Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^2: Loops and variable usage

by BillKSmith (Curate)
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://961447]
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: (5)
As of 2015-11-29 06:17 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (747 votes), past polls