perlquestion
perlnoobster
hi guys,
I was wondering if someone could help me, I've got a list of strings that need to be scrubbed, my method below isn't the most efficient but i am unsure of other methods that can help me:
<code>
if ($colr =~'baby blue')
{
$trimmedcolr = 'BB';
}
if ($colr =~'baby pink')
{
$trimmedcolr = 'BP';
}
if ($colr =~'dark blue')
{
$trimmedcolr = 'DB';
}
if ($colr =~'dark purple')
{
$trimmedcolr = 'DP';
}
if ($colr =~'hot pink')
{
$trimmedcolr = 'HP';
}
if ($colr =~'light purple')
{
$trimmedcolr = 'LP';
}
else
{
($trimmedcolr = $colr)
}
</code>
whilst the code is run it only replaced the strings that contain light pink excluding everything else? please can someone help me fix this?
Thank you :)