in reply to How Do I pass a hash to a subroutine?

And, if you need to pass multiple parameters (eg. a hash and then an array) pass by reference; otherwise the hashes and arrays are flattened into a single list and the sub can't tell what is part of which.

Here is an example of using prototypes to force a pass-by-reference.

sub foo(\%\@) { my ($hash_ref, $array_ref) = @_; #... } foo (%hash, @array);