in reply to Variables in Regular Expressions?

Your code has a transposed substitution operator (should be =~ not ~=). I don't recall 'tr' options off the top of my head, but a substitution like this will work fine:
$c =~ s/$a/$b/;