[Pdx-pm] reading a broken CSV file
ckuskie at dalsemi.com
Fri Nov 21 18:19:55 CST 2003
On Fri, Nov 21, 2003 at 04:35:12PM -0800, Eric Shore Baur wrote:
> Is there any neat/slick way to get this data in there on the first
> pass? I tried using ParseWords, but I'm not sure if I utilized it to its
> fullest extent. I briefly played with a CSV driver for DBI, but it
> couldn't handle things split over the newlines, either.
If the number of columns in each file is a constant, then you could try
Get a line.
Feed it into some module that handles CSV and returns an array of elements
Do I have enough columns?
NO: Remove newline from present line;
Fetch another line from file;
Append it to the current line and check again.
YES: Push data into database.
More information about the Pdx-pm-list