Do you know where your variables are? | |
PerlMonks |
Re: Strange behaviour of tr function in case the set1 is supplied by a variableby roboticus (Chancellor) |
on Nov 16, 2017 at 03:08 UTC ( [id://1203545]=note: print w/replies, xml ) | Need Help?? |
Feature, per the tr docs Characters may be literals or any of the escape sequences accepted in double-quoted strings. But there is no interpolation, so "$" and "@" are treated as literals. A hyphen at the beginning or end, or preceded by a backslash is considered a literal. Escape sequence details are in the table near the beginning of this section. So if you want to use a string to specify the values in a tr statement, you'll probably have to do it via a string eval:
...roboticus When your only tool is a hammer, all problems look like your thumb.
In Section
Seekers of Perl Wisdom
|
|