Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: If statement not working

by toolic (Bishop)
on Aug 24, 2012 at 13:53 UTC ( #989543=note: print w/replies, xml ) Need Help??


in reply to If statement not working

You need to change all but the 1st if to elsif:
if ( $colr =~ 'baby blue' ) { $trimmedcolr = 'BB'; } elsif ( $colr =~ 'baby pink' ) { $trimmedcolr = 'BP'; } elsif ( $colr =~ 'dark blue' ) { $trimmedcolr = 'DB'; } elsif ( $colr =~ 'dark purple' ) { $trimmedcolr = 'DP'; } elsif ( $colr =~ 'hot pink' ) { $trimmedcolr = 'HP'; } elsif ( $colr =~ 'light purple' ) { $trimmedcolr = 'LP'; } else { ( $trimmedcolr = $colr ); }

See also:

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2016-09-26 00:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (474 votes). Check out past polls.