in reply to Modify hash reference itself

Perhaps I have misread the replies, but I didn't see anyone suggest returning a hashref from the sub:
# Two hashes: %myhash; %b; # Merge them %myhash = %{mergetwohashes(\%myhash, \%b)}; sub mergetwohashes { return { %{$_[0]}, %{$_[1]} }; }
Though this isn't as efficient as the other solutions, it may be simple enough for what you are after.

-QM
--
Quantum Mechanics: The dreams stuff is made of