Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: switch, transliteration ( tr/// ) of $_ issue

by blazar (Canon)
on Nov 19, 2008 at 11:40 UTC ( #724554=note: print w/ replies, xml ) Need Help??


in reply to Re: switch, transliteration ( tr/// ) of $_ issue
in thread switch, transliteration ( tr/// ) of $_ issue

No real advantage, but for completeness:

my ($bar) = map +(0,'low','med','high')[tr/I//] || 'drat', $foo; # or my ($bar) = map qw(0 low med high)[tr/I//] || 'drat', $foo;

qw helps, and "0" is false...

--
If you can't understand the incipit, then please check the IPB Campaign.


Comment on Re^2: switch, transliteration ( tr/// ) of $_ issue
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2014-09-16 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (19 votes), past polls