in reply to Loop through array of hashes
Your @array = (%hash0, %hash1, %hash2, %hash3); will just flatten the four hashes into one list. Do this:-
my @array = ( \ %hash0, \ %hash1, \ %hash2, \ %hash3 );
instead. Then to access them:-
foreach my $hashref ( @array ) { print "$_\n" for keys %$hashref; }
Note that I use my as there should be a use strict; (probably along with a use warnings;) at the top of the script.
Cheers,
JohnGG
|
|---|