$_ = "\x{ff0a}\x{1234}"; open OUT, ">temp.txt"; binmode OUT, ":encoding(UTF-16le)"; print OUT; close OUT; # The output file contains FIVE bytes: 0D 0A FF 34 12 open IN, "; # this line causes: UTF-16LE:Partial character at temp.pl line 12. close IN;