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

Re: Multiple if-else statements using C-style ternary operator

by Marshall (Canon)
on Jul 11, 2011 at 22:44 UTC ( [id://913794]=note: print w/replies, xml ) Need Help??


in reply to Multiple if-else statements using C-style ternary operator

An even more concise coding doesn't use any if logic at all.
my @status_text = qw(LOW MODERATE HIGH); my $status = 2; print $status_text[$status];

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-03-28 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found