Actually, yes. There is a VERY good reason that I am not using
this module...
I had no idea that it existed. Now that I know, I'll take a
peak and see if this will indeed do the trick for me. Thanks a lot for
pointing me in the direction of the easy solution.
Scott Nipp
Phone: (214) 858-1289
E-mail: [EMAIL PROTECTED]
Web: http:\\ldsa.sbcld.sbc.com
-----Original Message-----
From: Jeff Zucker [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 07, 2004 1:18 PM
To: NIPP, SCOTT V (SBCSI)
Cc: [EMAIL PROTECTED]
Subject: Re: Parsing question...
Is there some reason you aren't using DBD::CSV or its parser
(Text::CSV_XS), which handle this and a number of other problem issues
with parsing CSV? Why reinvent the wheel?
--
Jeff
NIPP, SCOTT V (SBCSI) wrote:
> This isn't specifically a DBI question, but it is a part of a
> database script I am writing. I am parsing a CSV file and populating
a
> MySQL database table. The problem I have run into is that a couple of
> lines of data have a comma in a filed that is in quotes, such as
"First
> part, second part". This makes it difficult to parse the CSV file on
> commas like my intention was. Could someone help me figure out how to
> parse this? Thanks.
> Basically, I am reading in the file in a 'while' loop. I am
> then splitting the line into an array using the 'split' function. The
> next step is to simply populate the database table with the fields.
> Here is the 'split' I am currently using.
>
> < ...snip... >
> while (<DATA>) {
> @data = split(/,\s*/);
> print "$data[1]\n";
> }
> < ...snip... >
>
> Thanks in advance for the help.
>
> Scott Nipp
> Phone: (214) 858-1289
> E-mail: [EMAIL PROTECTED]
> Web: http:\\ldsa.sbcld.sbc.com
>
>
>
>