Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by BrowserUk (Pope)
on Mar 19, 2013 at 11:02 UTC ( #1024261=note: print w/ replies, xml ) Need Help??


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

$r =~ s[([a-zA-Z])][$1 lt '[' ? 'U' : 'L']ge;;

But this will be vastly more efficient:

$r =~ tr[A-Z][U]; $r =~ tr[a-z][L];

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.


Comment on Re: change [A-Z] to U, [a-z] to L with one regex?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024261]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2014-12-21 02:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (101 votes), past polls