in reply to Re: Can't get \n or other character/translation escapes to interpolate if originally read from a data file
in thread Can't get \n or other character/translation escapes to interpolate if originally read from a data file
... "translation escapes" sound like escapes that are only available to the regex substitution engine and not to normal strings ...
The \u \U \l \L \Q \E "translation escapes" are also available to the double-quote operator:
Win8 Strawberry 5.8.9.5 (32) Mon 03/15/2021 12:41:31 C:\@Work\Perl\monks >perl -Mstrict -Mwarnings my $foo = "%^&*("; my $bar = 'Bar'; my $string = "\U$bar\E \l\U$bar\E \Q$foo\E \n"; print $string; ^Z BAR bAR \%\^\&\*\(
Update: In fact, I think the only reason translation escapes are available to regex expressions is that double-quotish interpolation is done very early in compilation of a regex expression. IIUC, the first two steps are:
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Can't get \n or other character/translation escapes to interpolate if originally read from a data file
by pryrt (Abbot) on Mar 15, 2021 at 19:02 UTC |