in reply to Re: How to add column into array from delimited tab file
in thread How to add column into array from delimited tab file
my @aoa; # Array of arrays (2-d arrray) open my $CURINFILE, "<", $files[$i]" or die "Error couldn't open file +$files[$i]\n"; print "$files[$i]\n"; while(<$CURINFILE>) { chomp $_; push @aoa, [ split('\t')]; # Insert an array ref into the array +(which is what makes it 2-D) } close $CURINFILE; print "\nWriting output..."; #The first row of @aoa contains the titles, so skip that, and print th +e rest.... for my $row (@aoa[1..$#aoa]){ # That is a slice of the array, from in +dex 1 till the end print $row->[0]."\n"; # $row->[0] contains the contents of the fir +st column (ID) # Similarly, $row->[1] is the dataR1 column }
What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
-Larry Wall, 1992
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to add column into array from delimited tab file
by hellohello1 (Sexton) on Feb 17, 2014 at 07:43 UTC | |
by NetWallah (Canon) on Feb 17, 2014 at 08:59 UTC |