use strict; use warnings; sub foo { my %hash = (); .... %hash = .... # key/values populated by some API bar(\%hash); } sub bar { my $hash_ref = shift; my @arr_of_href = $hash_ref; foreach my $i (.....) { .... %some_hash initialized here for each iteration of the for loop push (@arr_of_href, \%some_hash); } zzz(\@arr_of_href); # zzz() will do something with this array }