in reply to Globally change ucfirst in mod_perl

Wouldn't it be easier to do
join ' ', map {ucfirst} split / /, shift;
Can't use ucfirst when you're redefining it, can you?
Update: Actually, you can!
I'll take my Bonehead Award anytime it's ready. Make it:
join ' ', map { s/^(.)/\U$1/; $_ } split / /, shift
That should work, right, since it's using uc instead of ucfirst.

To do it with pure s///:

(my $f=shift)=~s/(^| )(\w)/$1\U$2/g; # Doing it with lookbehind gets a little ugly: # s/(?:(?<=^)|(?<= ))(\w)/\U$1/g; $f;

The PerlMonk tr/// Advocate