In perl, I'm trying to build up a hash of a list of lists. It looks something like this:
my %entries;
while(<>)
{
if(/complicated regex ommitted/)
{
my @entry = ($2, $3, $4);
if(exists $entries{$1})
{
push @{$entries{$1}}, @entry;
}
else
{
$entries{$1} = @entry;
}
}
The resulting hash has all of the keys I expect, but the value "list of lists" isn't being built up correctly. What am I doing wrong?
Edit: Maybe there is something wrong with how I'm trying to access the resulting hash.. Here is that code
foreach $key (keys %entries)
{
my $size = {@entries{$key}};
# just says "HASH(0xaddress)"?
print "$key: $size\n";
foreach(@{entries{$key}})
{
# loop just goes through once, prints out just " : "
print "\t$_[0]: $_[1] $_[2]\n";
}
}