use strict; use warnings; my $t = 'öäü'; my $text = "häuser österreich übersiedeln\n"; ## $text =~ s/[öüä]//g; my @a = split '', $text; # $" = "\n"; # print "@a"; my @b = map {ord($_) < 127 ? $_ : sprintf "&#%d;", ord($_) } @a ; my $b = join '', map {ord($_) < 127 ? $_ : sprintf "&#%d;", ord($_) } split '', $text; ## '&#'.hex(ord($_)).';' } @a; print $b; # print "\n"; print $text; $text =~ s/(.)/ord($1) < 127 ? $1 : sprintf "&#%d;", ord($1)/eg; print $text;