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

Re: using if-elsif-else

by alpha (Scribe)
on Dec 28, 2006 at 10:47 UTC ( [id://592069]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to using if-elsif-else

chomp (my $name = <STDIN>); if ($name =~ /^derrick\b/i) { print $phnums{"derrick"}; } elsif ($name =~ /^juan\b/i) { print $phnums{"juan"}; } elsif ($name =~ /^kevin\b/i) { print $phnums{"kevin"}; }
Also you sould Read The Frienly Manuals more often :) Update:
chomp(my $name = <STDIN>); $name =~ /^$_/ and print ($phnums{$_}.chr 10) for keys %phnums

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://592069]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.