Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by whakka (Hermit)
on Nov 18, 2008 at 15:56 UTC ( #724306=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    switch ( $foo ) {
        case ( tr/I/I/ == 1 ) { $bar = 'low' }
    ...
        case ( tr/I/I/ == 3 ) { $bar = 'high' }
        else { warn "Bad $_\n" }
    }
    
  2. or download this
    Use of uninitialized value $_ in transliteration (tr///)
    
  3. or download this
    #!perl! -w
    use strict;
    ...
    }
    
    print "Foo: $foo Bar: $bar\n";
    
  4. or download this
    given ( $foo ) {
        when ( tr/I/I/ == 1 ) { $bar = 'low' }
    ...
        when ( tr/I/I/ == 3 ) { $bar = 'high' }
        default { $bar = "drat" }
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://724306]
Approved by kyle
Front-paged by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2018-10-22 18:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (121 votes). Check out past polls.

    Notices?