in reply to Convert hash of hashes into array of hahes
Instead of foreach, use each with while loops.
Untested:
while( my( $key1, $ref1 ) = each %hash ) { while( my( $key2, $val2 ) = each %{$ref1} ) { push @Array, { $key2 => $val2 }; } }
Using keys in list context as the expression for a foreach loop is generating a list internally of all of the outer keys, and lists of inner keys. Switching to the while loop saves at least that much.
Dave
|
|---|