in reply to can not use utf8 with File::Slurp

You can pass a filehandle to write_file:
use File::Slurp qw(write_file); my $ustr = "simple unicode string \x{0434} indeed"; { open(my $FH, ">:encoding(UTF-8)", "a.txt") or die "Failed to open file - $!"; write_file($FH, $ustr) or warn "Failed write_file"; }

Replies are listed 'Best First'.
Re^2: can not use utf8 with File::Slurp
by vkon (Curate) on Feb 19, 2011 at 07:56 UTC
    I've used File::Slurp::write_file only to have shorter code.

    If I have open filehandle, then just using "print" would be even shorter :)

    Thanks for your another bit of knowledge, however!