in reply to How to use a variable in tr///
From the documentation:
Because the transliteration table is built at compile time, neither the SEARCHLIST nor the REPLACEMENTLIST are subjected to double quote interpolation. That means that if you want to use variables, you must use an eval():
eval "tr/$oldlist/$newlist/"; die $@ if $@; # or eval "tr/$oldlist/$newlist/, 1" or die $@;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to use a variable in tr///
by Roy Johnson (Monsignor) on Apr 08, 2005 at 13:27 UTC | |
by dmorelli (Scribe) on Apr 08, 2005 at 14:52 UTC | |
by nobull (Friar) on Apr 08, 2005 at 16:37 UTC |
In Section
Seekers of Perl Wisdom