Just want to give you some more extended info on this. Hope those are useful.
- Although it is not your purpose here, Perl does support l-value functions. An example would be the substr function:
$str = "135";
substr($str, 1, 1) = "234";
print $str;
This should give you "12345";
- If you are not comparing numbers, but strings, then you should use 'eq', instead of '=='.
$str1 = "01";
$str2 = "1";
print "equal as numbers\n" if ($str1 == $str2);
print "equal as strings\n" if ($str1 eq $str2);