use strict; use warnings; use Text::CSV_XS; my $tr_csv = Text::CSV_XS->new({ binary => 1, eol => $/ }); open(my $tr,"<",'file.csv') or die "Failure opening ERS data file: $!"; while (my $row = <$tr>) { $tr_csv->parse($row); print $tr_csv->error_diag(),"\n"; }