So what I think I see here is a hash containing an Array reference, and indeed if I print:$VAR1 = { 'Addresses' => { 'ArrayOfAddressResponse' => { 'AddressRespo +nse' => [ + { + 'CountyName' => 'NEW YORK', + 'Street2' => {}, + 'LastLine' => 'NEW YORK NY 10025-4857', + + }, + { + 'CountyName' => 'NEW YORK', + 'Street2' => {}, + 'LastLine' => 'NEW YORK NY 10025-4858', + + }, + { + 'CountyName' => 'NEW YORK', + 'Street2' => {}, + 'LastLine' => 'NEW YORK NY 10025-4808', etc.
I get an "ARRAYx..." So I'm thinking I'd like to iterate through that list and do something with the values, so I do:$content->{Addresses}{ArrayOfAddressResponse}{AddressResponse}
But when I do this and print $response inside the loop, it tells me it's an ARRAY. I can even dereference the data within the loop with like $response->[0]{Street}. But that doesn't seem to make sense. What am I mis-conceptualizing, here? I guess the crux of it is I can't figure out what to put inside the foreach parentheses to let me iterate through the list of hashes. Any input would be greatly appreciated!foreach my $response ( $content->{Addresses}{ArrayOfAddressResponse}{A +ddressResponse} ) {...
In reply to Trouble dereferencing an array of hashes by rastoboy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |