in reply to Globally change ucfirst in mod_perl
Can't use ucfirst when you're redefining it, can you?join ' ', map {ucfirst} split / /, shift;
That should work, right, since it's using uc instead of ucfirst.join ' ', map { s/^(.)/\U$1/; $_ } split / /, shift
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;
|
|---|