123456789101112
use Encode qw(encode decode);my $enc = 'utf-8'; #in dieser Kodierung ist das Script gespeichertsub ucfirst_every_word { my $s = shift; my $text_str = decode($enc, $s); $text_str =~ s{\b(\w+)\b}{ucfirst(lc($1))}eg; $s= encode($enc, $text_str); return $s;}$text =~ s/(= .*?KAPITEL.*? =)/ucfirst_every_word($1)/eg;