in reply to How to populate a HASH using a FOR loop to a FUNCTION
%myHash = &makeHash($key, $val, \%myHash)
Skip the left part and you are fine, no need to reset the hash. :)
makeHash($key, $val, \%myHash)
Your makeHash() is seriously broken.
Please have a look at perlref to understand how references work.
my $subHashRef = shift @_; $subHashRef->{$key} = $val;
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
|
|---|