Graeme McLaren wrote: > Morning all, I have a problem that I can't see a way around. Basically > I have an array of hashes and I want to get the key and value of each > hash but with the following code I'm getting: > > Type of arg 1 to keys must be hash (not array element) at > /usr/lib/perl5/vendor_perl/Purchaser/Common.pm line 477, near "]) " > > #code: > > foreach my $key (keys $AoH[$map_loop{$i}]) { > my $value = $AoH[$map_loop{$i}]->{$key}; > > } > > > Is there a way to loop over an array of hashes?
foreach my $key ( keys %{ $AoH[ $map_loop{ $i } ] } ) { my $value = $AoH[ $map_loop{ $i } ]{ $key }; } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>