Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Filtering rows with Parse::CSV

by toolic (Bishop)
on Mar 27, 2017 at 18:14 UTC ( #1186114=note: print w/replies, xml ) Need Help??


in reply to Filtering rows with Parse::CSV

I don't see any commas in your input. Does your input actually have "row 1-4:"? Post the 1st 9 lines of your input file, exactly as they appear in the file. Use "code" tags.

Replies are listed 'Best First'.
Re^2: Filtering rows with Parse::CSV
by Tetris78 (Initiate) on Mar 27, 2017 at 18:44 UTC
    Thanks for your help. That was it! The first 2 columns had commas within the data. I removed the first two columns, and it ran as expected.

    UPDATE

    I may have spoken too soon. As soon as I put the columns back (along with several other columns I removed), I ran into issues again. The filter is working as expected, however, the while loop exits after about 240 rows. I'm assuming it's due to the size of the file (155k KB)... Is there a size limit to the Parse::CSV module?

      the while loop exits after about 240 rows. I'm assuming it's due to the size of the file
      I doubt if your problem is due to the size of the file - Parse::CSV is designed specifically to handle large files, and only reads one line at a time.

      You could try adding this line after your loop:

      print $parser->errstr;
      I suspect, though, that the problem has something to do with the structure of your data - does it change in any way around row 240? You mention that some of the columns have commas within - maybe you could post some of your input data here (inside <code></code> tags).

      What module version do you have, add this line to see

      print $Parse::CSV::VERSION;
      poj

        I have version 2.04

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1186114]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2022-01-25 17:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (67 votes). Check out past polls.

    Notices?