Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 examining the Monastery: (12)
As of 2014-08-22 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (164 votes), past polls