bishop2001 has asked for the wisdom of the Perl Monks concerning the following question:
Hi, This is what i have at this point. A hash key contains the 3rd element of an array and the value is the other 2 elements of an array
This is the data i am working on
12,1427766557, bob 5,1427766556, bill 10,1427766555, bob
i just need to read this out so that it will look like this. Help please? im hoping to export this as a csv.my %data; open(DATA, '<<', 'test.csv') or die "Can't open file: $!"; while (my $row=<DATA>) { @$_ = split /(?:,|\s)+/, $row; $#$_!=2 ? next : push @{$data{$_->[2]}}, @$_[1,0] }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl print to csv
by Athanasius (Archbishop) on Apr 21, 2015 at 03:58 UTC | |
|
Re: perl print to csv
by Marshall (Canon) on Apr 21, 2015 at 04:07 UTC | |
|
Re: perl print to csv
by CountZero (Bishop) on Apr 21, 2015 at 06:25 UTC | |
by Marshall (Canon) on Apr 21, 2015 at 06:35 UTC | |
by Athanasius (Archbishop) on Apr 21, 2015 at 07:11 UTC | |
by bishop2001 (Initiate) on Apr 21, 2015 at 12:16 UTC | |
by hdb (Monsignor) on Apr 21, 2015 at 13:38 UTC | |
| |
by AnomalousMonk (Archbishop) on Apr 21, 2015 at 14:54 UTC |