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/;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: change [A-Z] to U, [a-z] to L with one regex?
by BrowserUk (Patriarch) on Mar 19, 2013 at 23:47 UTC | |
by jwkrahn (Abbot) on Mar 20, 2013 at 02:15 UTC | |
Re^3: change [A-Z] to U, [a-z] to L with one regex?
by hdb (Monsignor) on Mar 20, 2013 at 08:27 UTC |
In Section
Seekers of Perl Wisdom