Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by Roy Johnson (Monsignor)
on Nov 18, 2008 at 21:53 UTC ( #724399=note: print w/ replies, xml ) Need Help??


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

Or you could opt for the old-school approach, and just replace your switch with for, and your whens with if-elsifs:

for ( $foo ) { if ( tr/I/I/ == 1 ) { $bar = 'low' } elsif ( tr/I/I/ == 2 ) { $bar = 'med' } elsif ( tr/I/I/ == 3 ) { $bar = 'high' } else { $bar = "drat" } }

Caution: Contents may have been coded under pressure.


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (14)
As of 2015-07-31 10:42 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 (276 votes), past polls