binmode($fh, ':encoding(UTF-8)'); sysrwite($fh, $text); # Or: print $fh $text;