in reply to Strange behaviour of tr function in case the set1 is supplied by a variable

With eval statement works correctly. So it looks like $ is treated by tr as a regular symbol and no warning are issued.
$statement='$diff1=$str1'."=~tr/$str2//;"; eval($statement); print "With eval: diff1=$diff1\n";
that will produce:
With eval: diff1=3
</code> 
  • Comment on Re: Strange behaviour of tr function in case the set1 is supplied by a variable
  • Download Code