Help for this page
# method 1 - always use an array: while (my @values = fetchrow_array()){ my $hash = ($values[0] => [ $values[1] ]); push (@{$hash{$values[0]}}, values[2]) }
# method 2 - switch scalars to arrays dynamically (good for other # cases, not so good for yours, here for completeness only) ... $hash{$values[0]} = [ $hash{$values[0]} ]; } push @{$hash{$values[0]}}, $hash{$values[2]};