in reply to How to find all occurrences of a key in a deeply nested structure?

What have you tried?

I'd write a subroutine that receives a hash ref as an argument, and stores the right value if the key in question is there. Then it recurses into all the values that are hashrefs.

  • Comment on Re: How to find all occurrences of a key in a deeply nested structure?

Replies are listed 'Best First'.
Re^2: How to find all occurrences of a key in a deeply nested structure?
by deMize (Monk) on Oct 20, 2011 at 14:58 UTC
    First: I'm not sure why asking a valid question is worth -1 rep, but I guess that's someone's opinion. Anyhow, Tye came out with Data::Diver, so I was hoping there would be an easier way than to build my own recursive "find" tool. I can see how to set values with his module, but not sure how to scan for all occurrences.


    Demize
      It's worth -1 because we're not here to do all your work - or your homework! - for you. We can help you more if you show us what you've already tried and explain how its results differ from what you expected.