Ty everyone;
I stumbled abon a CSV module that did the trick... Wasn't in CPAN though (or
rather, CPAN search didn't find it)... Simply called CSV, worked wonders...
(http://rath.ca/Misc/Perl_CSV/CSV-2.0.tar.gz)
use CSV;
my ($CK, $NAME, $ADDRESS, $TYPE) = CSVsplit($_);
:P
--
me
----- Original Message -----
From: "Timothy Johnson" <[EMAIL PROTECTED]>
To: "'Chris Knipe'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, February 20, 2003 10:55 PM
Subject: RE: CSV inports...
>
> I would use DBD::CSV or (I think) Text::CSV. I have a routine that I
tried
> to use in the past, but it gets more complicated than the split solution:
>
> open(INFILE,"myfile.csv");
> while(<INFILE>){
> my @fields;
> while($_ =~ /(\".*\")?,?([^\"]*)/g){
> push @fields,$1;
> push @fields,split(/,/,$2);
> }
> print OUTFILE join(',',@fields);
> }
>
>
>
> -----Original Message-----
> From: Chris Knipe [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 20, 2003 12:34 PM
> To: [EMAIL PROTECTED]
> Subject: CSV inports...
>
>
> Lo all,
>
> I got a little problem with a CSV import... It should be rather straight
> forward to people who do this often.. so I'm hoping for some help...
>
> I have a MS Excel exported CSV text file, with , separated values. The
> problem now, is that some of the values also contains a , character, and
MS
> Excel thus put the values in a quote such as:
> "blah, blah", blah, "blah, blah, blah"
>
> I have:
> open(FILE, "<CC.csv");
> while (<FILE>) {
> my ($CK, $NAME, $ADDRESS, $TYPE) = split(',', $_);
> }
> close(FILE);
>
> But this obviously does not work, seeing that it ignores values included
in
> the quotes "...
>
> How would I go about fixing this little issue?
>
> --
> me
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]