Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: uc() every other letter

by George_Sherston (Vicar)
on Sep 28, 2001 at 15:02 UTC ( [id://115367]=note: print w/replies, xml ) Need Help??


in reply to uc() every other letter

How about a generic solution with a regex? Turn @lcase into a string, then
$lcase =~ s/(\w{1})(\w{1})/{$1.uc$2}/eg;

§ George Sherston

Replies are listed 'Best First'.
Re: Re: uc() every other letter
by stefp (Vicar) on Sep 28, 2001 at 18:01 UTC
    simpler:
    $lcase =~ s/(\w)(\w)/\l$1\u$2/g

    -- stefp

      Smart! Every day I learn something. Hmm. And if it's short we want, one might go as far as s/(.)(.)/$1\u$2/g

      § George Sherston

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-25 20:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found