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 cooling their heels in the Monastery: (7)
As of 2015-07-02 01:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (25 votes), past polls