Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Hi Sam,

    I know I am late to the party, but try installing PerlIO::eol and give the following a try:

    my $csv = Text::CSV_XS->new ({ binary => 1, eol => $/ });
    open my $io, "<:raw:eol(Native)", $filename or die "$filename: $!";
    while (my $row = $csv->getline($io)) {
      ...
    }

    Text::CSV_XS can use an IO::Handle object, and the IO::Handle object can convert line endings on the fly for you using PerlIO::eol. This also has the added benefit of handling fields with embedded newlines.