Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I want to use an array each to get all the column values for every column in a pipe delimited file, please correct the code below with arrays... any help appreciated
... my @colvalues1; my @colvalues2; my @colvalues3; ... push @colvalues1, $allcols[0],':',$allcols[1],"\n"; push @colvalues2, $allcols[0],':',$allcols[2],"\n"; push @colvalues3, $allcols[0],':',$allcols[3],"\n"; ... open my $out1, '>>', "$colnamesxp[1].txt" or die $!; open my $out2, '>>', "$colnamesxp[2].txt" or die $!; open my $out3, '>>', "$colnamesxp[3].txt" or die $!; ... foreach (@colvalues1){print $out1 "$_"}; foreach (@colvalues2){print $out2 "$_"}; foreach (@colvalues3){print $out3 "$_"};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: push values to an element of an array and read the same
by Athanasius (Archbishop) on Sep 28, 2017 at 07:32 UTC | |
|
Re: push values to an element of an array and read the same
by GrandFather (Saint) on Sep 28, 2017 at 08:53 UTC | |
|
Re: push values to an element of an array and read the same
by Corion (Patriarch) on Sep 28, 2017 at 07:19 UTC |