use locale; use POSIX qw(locale_h); use POSIX; use Encode; my $old_lcall = setlocale(LC_ALL); my $old_ctype = setlocale(LC_CTYPE); setlocale(LC_ALL,"cs_CZ.utf8"); setlocale(LC_CTYPE,"cs_CZ.utf8"); # ...the $text variable has also been encoded as UTF-8 (the # hyphenated version), using the encode function provided # by use Encode; my @letters = split //, $text; # and at the end of the code, set the locales back: setlocale(LC_ALL, $old_lcall); setlocale(LC_CTYPE, $old_ctype);