use strict; my $my_name = "august ferdinand mobius"; $my_name =~ s/\b(\w)/\U$1/g; print $my_name; #prints August Ferdinand Mobius