On Thursday, Oct 3, 2002, at 21:52 Asia/Tokyo, Jarkko Hietaniemi wrote:
your source code is other text encodings than UTF-8. But tr/// does
not embrace this magic.
Clarification: tr/A-E/P-T/ (the ranges) does not embrace that magic.
tr/ABCDE/PQRST/ does work with the encoding pragma since that employs
string literals.
Aw...... I didn't even try.
But tr/// w/o range is like a regex w/o char class....
Oh yes, char class and does work w/ use encoding and w/ range. This
counter-intuitive example was discovered before I came up with eval
qq{} trick;
# eval qq{ \$kana =~ tr/\xA4\xA1-\xA4\xF3/\xA5\xA1-\xA5\xF3/ };
my $offset = ord("\xA5\xA1") - ord("\xA4\xA1");
$kana =~ s/([\xA4\xA1-\xA4\xF3])/chr(ord($1) + $offset)/eg;
Dan the Man with Too Many Backslashes fed for a day :)