sub f { my ($AoH) = @_; for my $hashref (@$AoH) { # do something with $hashref } } #### ... # somewhere in your code f($AoH); ... # elsewhere in your code f([$hashref1, $hashref2]); ... # and at some other point f([\%hash]); ... #### sub g { my ($arrayref_containing_just_one_hashref) = @_; my $hashref = $arrayref_containing_just_one_hashref->[0]; # do something with $hashref }