my @array_of_hashes = \( %finalMap1, %finalMap2, ... ); foreach my $finalMap_ref ( @array_of_hashes ) { push @returned_sorted, [ sortedHash( %{$finalMap_ref} ) ]; push @percentile_index, [ percentile( @{$returned_sorted[-1]} ) ]; } #### push @percentile_index, [ percentile( sortedHash( %{$finalMap_ref} ) ) ];