use open IO => ':utf8'; use strict; my $text = 'Umlaut Ü'; open(OUT, '>', 'test.txt') || die "test.txt:$!"; print OUT "$text\n"; close(OUT);