Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
laziness, impatience, and hubris
 
PerlMonks  

Re: Capitalize First Letter of Each Word

by holli (Abbot)
on Jun 30, 2005 at 09:04 UTC ( [id://471293]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Capitalize First Letter of Each Word

my @a = ( "THIS IS TESTING", "JOE MARCONES", "RESIDENTIAL MAINTENANCE COMPANY", ); s/(?<=\w)(.)/\l$1/g for @a; print join "\n", @a;
Update: replaced \1 by $1 as per tlm's suggestion.


holli, /regexed monk/

Replies are listed 'Best First'.
Re^2: Capitalize First Letter of Each Word
by tlm (Prior) on Jun 30, 2005 at 09:39 UTC

    Small nit: the use of backreferences like \1 in the second clause of s/// is deprecated. E.g.:

    % perl -we '$_="foo"; s/(.)/\1/' \1 better written as $1 at -e line 1.

    the lowliest monk

Re^2: Capitalize First Letter of Each Word
by suaveant (Parson) on Jun 30, 2005 at 10:42 UTC
    Heh... these fonts are bad. When I first read this I saw slash-one dollar-one, and was trying to figure out what the heck you were smoking. Then realized \l was slash-ell... characters aren't exaclty the same but that are really close to it. :)

                    - Ant
                    - Some of my best work - (1 2 3)

      So fix your fonts and stop complaining?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://471293]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.