Because:
eval { $t =~ tr/$search/$replace/; };
is just normal perl code where there is no interpolation so '$' is replaced with '$' and 's' is replaced with 'r' and 'e' is replaced with 'e' and 'a' is replaced with 'p', etc. while using string eval interpolates the variables $search and $replace.
In reply to Re^4: doing tr/// on-the-fly?
by jwkrahn
in thread doing tr/// on-the-fly?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |