You said:
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.

Well, I'm sorry, but you're going to have to prove that, by posting a runnable snippet of code with appropriate data that demonstrates your problem.

I tried writing a little snippet of code with data to replicate what you describe, and I didn't see any problem:

#!/usr/bin/perl use strict; use warnings; use Text::CSV_XS; # this is what reported an error, right? my $target = ( @ARGV ) ? shift : 'egik'; my $csv = Text::CSV_XS->new; my @keep; while ( my $row = $csv->getline( \*DATA )) { $row->[4] =~ /[$target]/ or next; push @keep, $row; } print join( " : ", @$_ )."\n" for ( @keep ); __DATA__ a,b,"c,c",d,e,f,g,h b,c,d,e,"f,f",g,h,i c,d,e,f,g,h,"i,i",j "d,d",e,f,g,h,i,j,k e,f,g,h,i,j,k,"l,l" f,"g,g",h,i,j,k,l,m g,h,i,"j,j",k,l,m,n h,i,j,k,l,"m,m",n,o
I gather your system has both Text::CSV and Text::CSV_XS installed (and former uses the latter when it's available), but since you say CSV_XS reported the error, I used that explicitly. (You can set it back to Text::CSV if you want.)

By default, the test script (let's call it "test_script") outputs four lines from the test data. If I put one or more matchable letters as a command line arg, it will output as many lines as match the given letters (e.g. test_script f will output 1 line, test_script e-l will output all 8 lines). No problems with quoted fields, even though each line has a quoted field somewhere in it.

So see if you can post a similar snippet that proves the problem you are talking about.


In reply to Re: CSV_XS ERROR: 2027 - EIQ - Quoted field not terminated @ pos 408 by graff
in thread 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.