On Fri, Nov 26, 2004 at 12:38:50AM -0000, Aleksey Maksimov wrote:
> $a=\"\\t\";

Assume you mean $a="\t";

> $a=~tr/0123456789/0123456789/cd;
> print $a;
> 
> Output:
> 9
> 
> The problem persists for all characters between \\x00 and \\x09 inclusive. 
> The output contains 0-9 digit that replaced \\x00-\\x09 code. By the way, 
> tr/0-9//cd works as expected.

Isn't that what you want?  /cd says the left part is complemented, and to
delete anything beyond the number of replacements on the right, so it's
translating characters \x00 through \0x2f and \x3a on up.  Since there
are replacements ("0123456789") specified for \x00 through \x09,
those get translated into the digits; any other non-digit character
gets deleted.

Perhaps you should reread the documentation for tr (perldoc perlop,
search for SEARCHLIST).

Reply via email to