in reply to How to populate a HASH using a FOR loop to a FUNCTION

Tl;dr but

%myHash = &makeHash($key, $val, \%myHash)

Skip the left part and you are fine, no need to reset the hash. :)

 makeHash($key, $val, \%myHash)

update

Your makeHash() is seriously broken.

Please have a look at perlref to understand how references work.

update
Better (among many things)

my $subHashRef = shift @_; $subHashRef->{$key} = $val;

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)