in reply to Text::CSV_XS and "binary" mode

Did you consider using getline () instead of <> and parse ()?

my $csv = Text::CSV-> new ({ binary => 1 }); while (my $row = $csv->getline (*INFILE) { my @fields = @$row; } $csv->eof or $csv->error_diag;

You can change the loop to catch your trash records.


Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^2: Text::CSV_XS and "binary" mode
by bittis (Sexton) on Jan 26, 2009 at 08:14 UTC
    Hey there, The following didn't work :( I now only get 44 rows of records before it breaks. I also tried setting binmode on the file as suggested. It still breaks when it meets a carriage return character. Where should i be catching my trash records?

      If it breaks because of parsing errors, $csv->error_diag () should give you a clear error message, which could hint you towards using other options. Showing the error message could help others here to give you advice on how to continue.


      Enjoy, Have FUN! H.Merijn