Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Capitalize the first letter of each word

by injunjoel (Priest)
on Jul 11, 2005 at 19:46 UTC ( #474072=note: print w/replies, xml ) Need Help??


in reply to Capitalize the first letter of each word

Greetings all,
Yet another way to do it.
use strict; my $text = "to say it once"; $text =~ s/(\w+)/\u\L$1/g; print $text;
produces:
To Say It Once

-InjunJoel
"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo

Replies are listed 'Best First'.
Re^2: Capitalize the first letter of each word
by brian_d_foy (Abbot) on Jul 11, 2005 at 20:26 UTC

    Of course, your solution is broken for the reasons I explain in perlfaq4.

    --
    brian d foy <brian@stonehenge.com>
      Thanks for the heads up.

      -InjunJoel
      "I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2023-02-05 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (33 votes). Check out past polls.

    Notices?