##
sub foo {
my %hash = @_;
}
# works fine
foo(%hash);
# uh oh
foo('nameofhash', %hash);
# not good at all
foo(@names, %hash);
####
# pass a reference to %hash, which is a scalar
foo(\%hash);
sub foo {
my $hashref = shift;
}
####
sub foo {
my $hashref = shift;
# add data
bar($hashref);
}
sub bar {
my $hashref = shift;
# manipulate data as above
}