http://www.perlmonks.org?node_id=446013


in reply to Re: How to use a variable in tr///
in thread How to use a variable in tr///

As merlyn points out, that's not delimiter safe. However, it can be made safe with quotemeta:
eval sprintf "tr/%s/%s/", map quotemeta, $oldlist, $newlist;
Update: of course nobull's construction below is much clearer. It should have occurred to me to say
eval "tr/\Q$oldlist\E/\Q$newlist\E/";

Caution: Contents may have been coded under pressure.