Re: RFC 165 (v1) Allow Varibles in tr///

[email protected] (Mark-Jason Dominus)
Newsgroups perl.perl6.language.regex
Message-ID <[email protected]>
> Accepting variables in tr// makes no sense. It defeats the purpose of
> tr/// - extremely fast, known transliterations.

The propsal extends tr/// to handle extremely fast transliterations
whose nature is not known at compile time.

> 
> tr///e is the same as s///g:
> 
>     tr/$foo/$bar/e  ==  s/$foo/$bar/g

It is nothing of the sort.

        $foo = 'fo';
        $bar = 'ba';

        $s1 = $s2 = "foolproof";

        $s1 =~ tr/$foo/$bar/e;
        # The result is "baalpraab";

        $s2 =~  s/$foo/$bar/g;
        # The result is "baolproof"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.