while (my $line = <>) { $line =~ /^\x{FEFF}//; # strip BOM # rest }