Re: RFC 165: Allow variables in a tr///

[email protected] (Mark-Jason Dominus)
Newsgroups perl.perl6.language.regex
Message-ID <[email protected]>
> Would there be any interest in adding these two ideas to this RFC:
> 
> 1) tr is not regex function, so it should be regularized to
> 
>    tr(SEARCH, REPLACE, MOD, STR)

MOD should be last, because you're frequently going to want to omit MOD.  

But I think this is worth discussing further, because it neatly
accomplishes the goal of the RFC in a straightforward way:

        tr('a-z', 'A-Z', $str)

replaces a-z with A-Z, and

        tr($foo, $bar, $str)

replaces the characters from $foo with the characters from $bar.
No special syntax is necessary.

People might even stop writing things like

        tr/[a-z]/[A-Z]/

if we did that.
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.