convenientstore has asked for the wisdom of the Perl Monks concerning the following question:
sample datause strict; use Text::CSV_XS; my @fields; sub input { my @attrs = qw(_status _gwname _ac_ID_field); my $csv = Text::CSV_XS->new; while (<>) { chomp; next if /^START/; $csv->parse($_); my @fields = $csv->fields; local $" = '|'; my %rec; @rec{@attrs} = split /|/; push @fields, \%rec; } } input (); foreach my $info (@fields) { print "${@fields}[0]{_status}"; }
adfadfasdfadsf,"adsf,asdf,adsf",adfasdf adsfasdfasdfasdf,asdfasdfasdf,adsfasdf adsfasdf,"adsf,adsf",adsfadsf "asdfasdf,asdfasdf",adfasdf,asdfasdf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: reference question yet again
by FunkyMonk (Bishop) on Sep 09, 2007 at 21:17 UTC | |
by convenientstore (Pilgrim) on Sep 09, 2007 at 21:35 UTC | |
by almut (Canon) on Sep 10, 2007 at 00:07 UTC | |
by convenientstore (Pilgrim) on Sep 10, 2007 at 01:21 UTC | |
by TGI (Parson) on Sep 10, 2007 at 17:31 UTC |