my $file = "somefile.utf8"; # create a UTF-8 encoded test file, explicitly adding a BOM open my $out, ">:utf8", $file or die $!; print $out "\x{feff}foo bär"; close $out; # read it back in open my $in, "<:encoding(utf8)", $file or die $!; $_ = <$in>; use Devel::Peek; Dump $_; #### SV = PV(0x793cd0) at 0x7c53e0 REFCNT = 1 FLAGS = (POK,pPOK,UTF8) PV = 0x7c9088 "\357\273\277foo b\303\244r"\0 [UTF8 "\x{feff}foo b\x{e4}r"] CUR = 11 ^^^^ LEN = 80