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

[email protected] (Tom Christiansen)
Newsgroups perl.perl6.language.regex
Message-ID <27698.967588078@chthon>
>Building a tr/// table is much much simpler and much less work than
>compiling a regex, but we don't make people write

>        eval " \$s =~ m/$pat/ "

>when they want to interpolate a string into a regex at run time.
>Instead, we take care of it transparently.  tr/// could easily be made
>to work the exact same way.

One thing to be careful of there is thread safety.  You can't hand
the data off the syntax node (the one with the tr op on it), because
tr/$foo/$bar/ wouldn't work for several threads in it at the same
time then.

--tom
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.