Syntactic Confectionery Delight | |
PerlMonks |
Re^7: Parse .csv file from FTP using Perlby Tux (Canon) |
on Jun 21, 2012 at 06:45 UTC ( [id://977580]=note: print w/replies, xml ) | Need Help?? |
muba already helped you with the basics, which were quite well explained. muba++. Text::CSV is a wrapper over Text::CSV_XS and Text::CSV_PP. Whatever is developed in Text::CSV_XS is copied into Text::CSV_PP making them behave exacly the same, but the XS version is up to 100 times as fast. Both act on streams of data, wheather that is a file or a pipe. That means that these modules do not allow to go "back" into the stream to look at previous lines. As muba already mentioned, getline_hr_all can be very handy here. If you need to do many lookups, like in a spreadsheet or a database, consider using DBD::CSV (when you are acquainted with DBI) or Spreadsheet::Read, which enables you to look at CSV file with the eye of a spreadsheet and enables you to direct access any field in a CSV data structure. One final remark about your original code. The "loop" could easily be shortened a lot:
update: corrected mumba to muba. sorry. Enjoy, Have FUN! H.Merijn
In Section
Seekers of Perl Wisdom
|
|