Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove BOM while reading file with Perl

Just remove the BOM from the first line in file readout

open(INPUT, $filePath) or die "Cannot read file $filePath";
my $line = <INPUT>;
#remove any BOM
$line =~ s/^\xEF\xBB\xBF//;

#[...]

close INPUT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.