in reply to How to use a variable in tr///
Regarding performance, s/(.)/$tr{$1}/eg is about 700 times slower than tr/// for long strings. The solution using eval and its precompiled version have only a constant overhead per invocation, which for very short strings is about 30% for the precompiled version, and about 30 times for eval. I was testing translation of all 256 possible byte values.
In Section
Seekers of Perl Wisdom