in reply to Re^2: Text::CSV_XS read from line X
in thread Text::CSV_XS read file from line X

Could it be that your data at that line looks somewhat like

1,"a",5,"ape " betablocker",16 ^

In that case, if the data is still valid, you should possibly add { allow_loose_quotes => 1 }, see here about two pages down.


Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^4: Text::CSV_XS read from line X
by tw (Acolyte) on Jan 04, 2011 at 09:09 UTC

    Thanks Tux,

    The entire file is read and pushed in the array if I turn on allow_loose_quotes. Gives me another option! Probably should have picked up on that myself.

    Does allowing loose quoting mean there might be a greater risk of something going astray?

      Not if the data is consistently doing this. It would not be strict CSV policy, but there are a zillion formats that look like but in fact break strict CSV definition. Text::CSV_XS has been stuffed with options to accommodate for all these varieties.


      Enjoy, Have FUN! H.Merijn