Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: how to use fgets to Break file into individual records

by mr_mischief (Monsignor)
on Apr 08, 2015 at 16:29 UTC ( [id://1122818]=note: print w/replies, xml ) Need Help??


in reply to how to use fgets to Break file into individual records

I'm not sure I understand. In a CSV file a row is a record. Do you mean individual fields of the record? There's split, or m// with captures, or you could write a full parser with something like Parse::YAPP or Parse::RecDescent.

There are a number of tools that do this correctly already, and very few first-time attempts get it right. Take a look at these:

* These require DBI and to treat the data as if it was a database.**
** That's handy if you're already using DBI for something else in the application or intend to replace the CSV files with a database later.

  • Comment on Re: how to use fgets to Break file into individual records

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-18 19:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found