[Denver-pm] Denver-pm Digest, Vol 12, Issue 1

Jon three18ti at gmail.com
Tue Jul 1 13:58:38 PDT 2014


Hi Robert,

Can you give us a little more of your code?  It works as expected for me
using both Text::CSV_XS and Text::CSV:

>> $ perl -v
>> This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux

>> $ perl -MText::CSV_XS -MData::Dumper -e '$_ = "file 1,file 2,\"foo,
bar\",file 3"; my $csv = Text::CSV_XS->new(); $csv->parse($_); @cols =
$csv->fields; print Dumper \@cols;'
>> $VAR1 = [
>>           'file 1',
>>           'file 2',
>>           'foo, bar',
>>           'file 3'
>>         ];

>> $ perl -MText::CSV -MData::Dumper -e '$_ = "file 1,file 2,\"foo,
bar\",file 3"; my $csv = Text::CSV_XS->new(); $csv->parse($_); @cols =
$csv->fields; print Dumper \@cols;'
>> $VAR1 = [
>>           'file 1',
>>           'file 2',
>>           'foo, bar',
>>           'file 3'
>>         ];

Best Regards,
Jon A



On Tue, Jul 1, 2014 at 1:00 PM, <denver-pm-request at pm.org> wrote:

> Send Denver-pm mailing list submissions to
>         denver-pm at pm.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mail.pm.org/mailman/listinfo/denver-pm
> or, via email, send a message with subject or body 'help' to
>         denver-pm-request at pm.org
>
> You can reach the person managing the list at
>         denver-pm-owner at pm.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Denver-pm digest..."
>
>
> Today's Topics:
>
>    1. Text::CSV not parsing embedded commas? (Robert L. Harris)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 1 Jul 2014 12:26:32 -0600
> From: "Robert L. Harris" <robert.l.harris at gmail.com>
> To: Denver-pm at pm.org
> Subject: [Denver-pm] Text::CSV not parsing embedded commas?
> Message-ID:
>         <CAOXayVsdxQfjBCvvW8HV83ZMP5jeQtdNgvy9CEibu=
> H2XU7fRg at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Given this line:
>
> $_=  file1,field2,field3,"more text, in this field 4",field5,field6
>
> I would expect the output of ( $va1, $var2, $var3, $var4, $var5, $var6
> )=$csv->fields(); to yield:
>
> $var1=field1
> $var2=field2
> $var3=field3
> $var4="more text, in this field 4"
> $var5=field5
> $var6=field6
>
> Instead though I get
>
> $var1=field1
> $var2=field2
> $var3=field3
> $var4="more text
> $var5= in this field 4"
> $var6=field5
>
> What am I missing?
>
> Robert
>
>
>
> --
> :wq!
> ---------------------------------------------------------------------------
> Robert L. Harris
>
> DISCLAIMER:
>       These are MY OPINIONS             With Dreams To Be A King,
>        ALONE.  I speak for                      First One Should Be A Man
>        no-one else.                                     - Manowar
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.pm.org/pipermail/denver-pm/attachments/20140701/f234ec09/attachment-0001.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Denver-pm mailing list
> Denver-pm at pm.org
> http://mail.pm.org/mailman/listinfo/denver-pm
>
>
> ------------------------------
>
> End of Denver-pm Digest, Vol 12, Issue 1
> ****************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/denver-pm/attachments/20140701/4e1227e7/attachment.html>


More information about the Denver-pm mailing list