E
ela
To access a spreadsheet file column by column, I use the 2D array @AoA to
store the contents. However, I don't know how to state in the for loop
because common perl tutorials assume access row by row. What should I
replace $#AoA with?
use warnings;
my ($rankfile) = @ARGV;
open (FP,$rankfile);
my @cells = (); my @AoA = ();
while ($line=<FP>) { chomp $line; @cells = split /\t/, $line;
push @AoA, [ @cells ];
}
%trials = ();
%sTrials = ();
for $i ( 0 .. $#AoA ) {
for $ik ( 0 .. $#{ $AoA[$i] } ) {
$trials{$ik} = $AoA[$i][$ik];
print $ik, "\t", $trials{$ik} , "\t", $AoA[$i][$ik]; <STDIN>;
}
}
store the contents. However, I don't know how to state in the for loop
because common perl tutorials assume access row by row. What should I
replace $#AoA with?
use warnings;
my ($rankfile) = @ARGV;
open (FP,$rankfile);
my @cells = (); my @AoA = ();
while ($line=<FP>) { chomp $line; @cells = split /\t/, $line;
push @AoA, [ @cells ];
}
%trials = ();
%sTrials = ();
for $i ( 0 .. $#AoA ) {
for $ik ( 0 .. $#{ $AoA[$i] } ) {
$trials{$ik} = $AoA[$i][$ik];
print $ik, "\t", $trials{$ik} , "\t", $AoA[$i][$ik]; <STDIN>;
}
}