Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
Just another Perl shrine
 
PerlMonks  

Re: If statement not working

by andye (Curate)
on Aug 24, 2012 at 14:54 UTC ( #989562=note: print w/ replies, xml ) Need Help??


in reply to If statement not working

It's because of your final statement, here:

if ($colr =~'light purple') { $trimmedcolr = 'LP'; } else { $trimmedcolr = $colr; }

(I've tidied it up a bit to make it clearer).

What you're saying with that is:

IF it's "light pink" then set trimmedcolr to 'LP' ELSE (if it's not "light pink") then set trimmedcolr to colr.
So, if any of the statements before that final one match, then 'light pink' won't match and so the ELSE part of that final statement will be executed.

e.g. if the colour is 'hot pink' then $trimmedcolr will be set to 'HP' and then set right back to $colr (in the bottom line).

HTH!


Comment on Re: If statement not working
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2014-04-18 08:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (464 votes), past polls