use Path::Tiny qw/ path /; my $outfh = path( "out.html" )->openw_utf8; say $outfh "\x{FEFF}\x{1F42A}\x{1F42B}"; close $outfh;