http://www.perlmonks.org?node_id=599732


in reply to UTF-8 text files with Byte Order Mark

A BOM is part of the text and it's a (sort of) valid character "ZERO WIDTH NON-BREAKING SPACE". Your best bet is just to strip it off since it's use (aside from providing a BOM) isn't recommended anyway:
while (my $line = <>) { $line =~ /^\x{FEFF}//; # strip BOM # rest }