in reply to If statement not working
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:
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.IF it's "light pink" then set trimmedcolr to 'LP' ELSE (if it's not "light pink") then set trimmedcolr to colr.
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!
|
---|