Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: How do I iterate through this data set?

by 7stud (Deacon)
on May 21, 2011 at 20:28 UTC ( #906093=note: print w/replies, xml ) Need Help??

in reply to How do I iterate through this data set?

You have this hash:

{ item => [ ... ... }

Immediately following the arrow is a bracket, and a bracket is the syntax for an array reference. So when you use the 'item' key to get its corresponding value, you get an array reference back. You are are treating the array reference as a hash reference.

Looking at the original data, the array has a bunch of hash references for elements. Hash references are denoted by braces: {...}

I would rename the variable in Corion's loop to help you keep track of what type you are getting out of the array:

for my $href (@{ $hash->{'searchResult'}->{'item'} }) { ... }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2018-08-18 21:37 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (186 votes). Check out past polls.