|
|
|
good chemistry is complicated, and a little bit messy -LW |
|
| PerlMonks |
Re: Confused by RegEx countby BillKSmith (Monsignor) |
| on Feb 22, 2024 at 19:52 UTC ( [id://11157853]=note: print w/replies, xml ) | Need Help?? |
|
Note that tr/SEARCHLIST/REPLACEMENTLIST/ is documented with "Quote Like Operators". That document shows that it can be used with variables with a little help from eval.
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 $@; eval "tr/$oldlist/$newlist/, 1"; die $@ if $@; In your case that would be
Bill
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||