Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 avoiding work at the Monastery: (6)
As of 2014-12-20 06:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (95 votes), past polls