develooper Front page | perl.perl5.porters | Postings from July 2018


Thread Next
Karl Williamson
July 17, 2018 01:49
Message ID:
We do not fully support tr with single quotes.  What does work is if all 
the characters in it are ASCII and  each is listed  without using 
ranges.  If you do use a range, instead the dash is taken literally, so

$ blead -le "my \$foo = 'B'; \$foo =~ tr'A-Z'a-z'; print \$foo"

$ blead -le "my \$foo = 'A'; \$foo =~ tr'A-Z'a-z'; print \$foo"

It would be some work to fix it to work properly in general, and I'm 
wondering if it is worth it, given that no one has ever complained, 
though I filed based 
on code reading.

Instead of fixing it, an easier option would be to detect any uses where 
it doesn't work as expected and to raise a warning, probably a 
deprecation one so that we can at some later point die on such uses.

Easier still is to document that a dash is taken literally.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About