Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The sample csv file as follows
Product Name,Product Code,Company1,Company2,Company3 Test One,C001,Y,N,N Test Two,C002,N,N,Y Test Three,C003,Y,Y,N
{ Company1 => {C001 => Y, C002 => N, C003 => Y}, Company2 => {C001 => N, C002 => N, C003 => Y}, Company3 => {C001 => Y, C002 => Y, C003 => N} }
Is there any CPAN module available to get this structureuse Text::CSV_XS; my $csv = Text::CSV_XS->new(); open my $FH, "<", "test.csv"; while (<$FH>) { $csv->parse($_); my @fields = $csv->fields;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Read data from csv file to a data structure format
by Tux (Canon) on May 18, 2012 at 07:17 UTC | |
by Anonymous Monk on May 18, 2012 at 07:56 UTC | |
|
Re: Read data from csv file to a data structure format
by choroba (Cardinal) on May 18, 2012 at 07:32 UTC |