laziness, impatience, and hubris | |
PerlMonks |
Re^4: Need help in reading csv files >1GB for converting into xlsx files in Solaris 10 - Perl v-5.8.4by Tux (Canon) |
on Feb 12, 2015 at 14:25 UTC ( [id://1116503]=note: print w/replies, xml ) | Need Help?? |
unless that data example can be public, please remove it again: it has e-mail addresses. If it is world-viewable, please add readmore-tags. Now back to the testing example. Explaining the extreme diff in cbxs is easy: you bind for just 6 columns, but you feed it way more (132), so the geline will return false. Having created a 30001 line version of your data example, and binding with the correct number of columns, I get
which is what I would expect. Now that I have seen your data, note that it actually resembles CSV: it only uses a pipe instead of a comma, but the fields between the pipes *are* quoted, so making a correct parser with split will (eventually) fail
See where I manually inserted a pipe? And what if this data allows embedded newlines between the quotes? As you are inserting the data between the pipes into XLS, your data will contain the quotes if you just split on pipes. I don't think that is what you want. These are the reasons why you need a CSV parser and not split. To parse this data quick and reliable, you could go with something like this:
HTH Enjoy, Have FUN! H.Merijn
In Section
Seekers of Perl Wisdom
|
|