Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: uc() every other letter

by Anonymous Monk
on Sep 29, 2001 at 19:58 UTC ( [id://115632]=note: print w/replies, xml ) Need Help??


in reply to uc() every other letter

this code:
--snip-- @lcase = (a..z); @other = (); for ($i = 0; $i <= $#lcase; $i++) { if ($i % 2) { @other[$i] = uc($lcase[$i]); } else { @other[$i] = $lcase[$i]; } } print "lcase:"; foreach $l (@lcase) { print " $l"; } print "\n"; print "other: "; foreach $o (@other) { print " $o"; } print "\n"; --snip--
gives these results:

$ perl asdsda.txt
lcase: a b c d e f g h i j k l m n o p q r s t u v w x y z
other: a B c D e F g H i J k L m N o P q R s T u V w X y Z

hope that helps.

Log In?
Username:
Password:

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

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

    No recent polls found