in reply to Making a hash of arrays using references
Looks like each time you are overwriting the hash entry with a new one element array.
Please try to push instead
push @{$hash{$affiliation}}, $name;
Depending on the Perl version you'd be allowed to leave the @{...} out. °
HTH :)
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
°) please forget, because (strangely) "Starting with Perl 5.14, an experimental feature allowed push to take a scalar expression. This experiment has been deemed unsuccessful, and was removed as of Perl 5.24."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Making a hash of arrays using references (push)
by Tmms (Initiate) on Apr 14, 2017 at 19:59 UTC |