sub count_orientation { my $ref = shift; my %x = %{(shift)}; # this is still correct! my $y = %{(shift)}; # ... } count_orientation($x, \%error_start, \%score); # or: count_orientation($x, {%error_start}, {%score});