ハッシュの配列を作成しようとしていますが、配列内の各ハッシュを参照する方法を知りたいですか?
例:
while(<INFILE>)
{
my $row = $_;
chomp $row;
my @cols = split(/\t/,$row);
my $key = $cols[0]."\t".$cols[1];
my @total = (); ## This is my array of hashes - wrong syntax???
for($i=2;$i<@cols;$i++)
{
$total[$c++]{$key} += $cols[$i];
}
}
close INFILE;
foreach (sort keys %total) #sort keys for one of the hashes within the array - wrong syntax???
{
print $_."\t".$total[0]{$_}."\n";
}
助けてくれてありがとう。