Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: If statement not working

by toolic (Chancellor)
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:


Comment on Re: If statement not working
Download Code

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 chanting in the Monastery: (9)
As of 2014-10-01 22:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (40 votes), past polls