- or download this
join ' ', map {ucfirst} split / /, shift;
- or download this
join ' ', map { s/^(.)/\U$1/; $_ } split / /, shift
- or download this
(my $f=shift)=~s/(^| )(\w)/$1\U$2/g;
# Doing it with lookbehind gets a little ugly:
# s/(?:(?<=^)|(?<= ))(\w)/\U$1/g;
$f;