Why are you using tr at all? This is likely best done with s///

$c =~ s!$a!$b!;

Cheers,
KM


In reply to Re: Variables in Regular Expressions? by KM
in thread Variables in Regular Expressions? by pchou

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":