The sigil for hash is %hash. &hash is an error.
Since a hash value must be a scalar, you need to make them array references.
See tye's References quick reference.while (<DATA>) { my ($key, $val) = split; push @{$hash{$key}}, $val; }
After Compline,
Zaxo
In reply to Re: Unique keys for multiple values with a Hash
by Zaxo
in thread Unique keys for multiple values with a Hash
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |