in reply to Re^7: Transform ASCII into UniCode (escape_metas)
in thread Transform ASCII into UniCode
That's more complicated than I thought because of the special nature of tr's arguments. :(
double-quotes allow interpolation and escape codes, single-quotes don't
DB<76> p "a\bc" c DB<77> p length "a\bc" 3 DB<78> p 'a\bc' a\bc DB<79> p length 'a\bc' 4 DB<80> p 'a\b' eq 'a\\b' 1
But tr forbids interpolation while allowing escape codes
DB<80> say '$l' =~ tr/$l/xyz/r # no interpolation xy DB<81> say "a\b" =~ tr/a\b/xyz/r # but escape codes xy
This makes evaling tr in a predictable way far too complicated.
Just escaping delimiters won't do, if escape codes are involved.
I think it's wise to give it up here.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|