Hello,

I get third party comma separated (csv) files. A csv file can has many non-ascii chars, which should not pose a problem.

My end goal is to filter out most of the csv data and then, with the resultant csv out file, create an Excel spreadsheet using the excellent csv2xls.pl program.

I am using Text::CSV for the I/O. In the code snippet below, the offending item seems to be "or next";

while ( my $row = $csv->getline( $in_fh ) ) {
$row->4 =~ m/Hardware/ or next;
push (@rows, ($row));
}

The difference between the csv2xls.pl program choking or not choking on the final output file depends only upon whether lines of data were filtered out. If I remove the "or next" I get back my original file, and it converts to Excel just fine, ableit loaded with far too much data.

This has baffled me for over a day. Anyone have any ideas?


In reply to CSV_XS ERROR: 2027 - EIQ - Quoted field not terminated @ pos 408 by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.