sub foo { my @arr = (); my %hash = (); .... %hash = .... # key/values populated by some API push(@arr, \%hash); bar(\@arr, ); # @arr contains only one item } sub bar { my $array_ref = shift; .... other function args are accessed here foreach my $i (.....) { .... %some_hash initialized here for each iteration of the for-loop push (@$array_ref, \%some_hash); } zzz($array_ref); # zzz() will do some read-only operations with this array }