in reply to Re^2: Transferring local hashes to module subroutines
in thread Transferring local hashes to module subroutines

All functions accept only one thing as arguments: a list of scalar.

When you do func(%hash), the hash gets flatten into a list. For example

sub show_args { print(join(', ', @_), "\n"); } my %hash = ( a=>1, b=>2, c=>3 ); show_args(%hash); # c, 3, a, 1, b, 2

Same goes if you also pass some scalars.

my %hash = ( a=>1, b=>2, c=>3 ); show_args(%hash, "d", 4); # c, 3, a, 1, b, 2, d, 4

So when you assign @_ to a hash (or an array), the hash absorbs the entire list. Perl has no way to know that only part of the assigned list should end up in the hash unless you tell it to.

Passing a reference to the hash avoids this issue too.