Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Print the string out in alternating upper and lowercase letters LiKe tHiS.

by BillKSmith (Monsignor)
on Jan 25, 2015 at 21:11 UTC ( [id://1114473]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Print the string out in alternating upper and lowercase letters LiKe tHiS.
in thread Print the string out in alternating upper and lowercase letters LiKe tHiS.

Odd length is only a problem if you have to change the last character. For this case we can use:
use strict; use warnings; my $string = 'athis'; print $string =~ s/(.)(.)/$1.uc$2/egr;
Bill
  • Comment on Re^3: Print the string out in alternating upper and lowercase letters LiKe tHiS.
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-24 22:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found