my $string = "vorname nachname"; $string =~ s/\b([a-z])/\U$1/g; print $string;