maybe u would try: foreach my $key (keys %{$AoH[$map_loop{$i}]}) { ....... }
because $AoH[$map_loop{$i}] is just a ref,so u get wrong. On Thu, 08 Sep 2005 09:42:33 +0100, "Graeme McLaren" <[EMAIL PROTECTED]> said: > 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? > > > Cheers for any light you can shed on this? > > > Cheers, > > Graeme :) > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > -- Jeff Pan [EMAIL PROTECTED] -- http://www.fastmail.fm - mmm... Fastmail... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>