# Two hashes: %myhash; %b; # Merge them %myhash = %{mergetwohashes(\%myhash, \%b)}; sub mergetwohashes { return { %{$_[0]}, %{$_[1]} }; }