Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Trouble dereferencing an array of hashes

by bobf (Monsignor)
on Nov 05, 2009 at 03:59 UTC ( [id://805130]=note: print w/replies, xml ) Need Help??


in reply to Trouble dereferencing an array of hashes

You are very close, and kudos for recognizing the hash of arrays (or more precisely, a hash of a hash of a hash of an array of hash references).

foreach iterates over a list, not a reference (see perlsyn). In this case, you need to dereference the array before foreach can use it.

foreach my $response ( @{ $content->{Addresses}{ArrayOfAddressResponse +}{AddressResponse} } ) { # do something with $response, which is a hash ref

Replies are listed 'Best First'.
Re^2: Trouble dereferencing an array of hashes
by rastoboy (Monk) on Nov 05, 2009 at 07:57 UTC
    Thanks All! I thought I'd tried that but I'm thinking I must have tried it with the parent key, and so it complained that it wasn't an Array. Actually, now that I think about it, I'm positive that's what I did. Cool...thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://805130]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-25 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found