Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by Roy Johnson (Monsignor)
on Nov 18, 2008 at 21:53 UTC ( [id://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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-03-28 20:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found