http://www.perlmonks.org?node_id=1024391


in reply to Re: change [A-Z] to U, [a-z] to L with one regex?
in thread change [A-Z] to U, [a-z] to L with one regex?

#$r =~ tr/[A-Z][a-z]/UUUUUUUUUUUUUUUUUUUUUUUUUULLLLLLLLLLLLLLLLLLLLLLL +LLL/; eval( '$r =~ tr/[A-Z][a-z]/'.('U' x 26).('L' x 26).'/' );

[A-Z] is 28 characters, not 26, so your expression is wrong.

This will work:

$r =~ tr/A-Za-z/UUUUUUUUUUUUUUUUUUUUUUUUUUL/;