Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Massive expansion of a hash of arrays?

by sundialsvc4 (Abbot)
on Jul 17, 2014 at 22:53 UTC ( #1094137=note: print w/replies, xml ) Need Help??

in reply to Massive expansion of a hash of arrays?

If the data-structure being traversed is deep and/or arbitrary, perhaps a tool such as Data::Walker will come in handy.   (There are many tools of this sort on CPAN ...)

These tools, as the name implies, allow you to “walk through” a data structure in a predictable way, regardless of its depth.   Might or might not be apropos in this particular situation, but worth knowing about anyhow.

  • Comment on Re: Massive expansion of a hash of arrays?

Replies are listed 'Best First'.
Re^2: Massive expansion of a hash of arrays?
by Anonymous Monk on Jul 17, 2014 at 23:02 UTC

    Thanks im reading up on it now. Meanwhile, i'd like to understand recursion better as this is the first ive come across it and it looks immensely useful for the future.

    Conceptually it seems simple enough, a function calling itself but i cant get my head around the details of what the code is doing!

      I recommend you start with the Wikipedia article titled Recursion (computer science). And because "recursion is one of the central ideas of computer science," you're going to find explanations and examples of it in any good computer science textbook.

      If you have an arbitrarily nested data structure with both arrays and hashes in it, then you're going to need to use the ref function. You'll use an if-then-else construct within your recursive function to decide what to do at each level in the nested data structure.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1094137]
[talexb]: TStanley Cool. Yeah, that's about 45 minutes away. Nice spot.
[TStanley]: I'm sitting in the airport in Tampa, Florida at the moment, getting ready to head home.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2017-06-23 14:10 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (548 votes). Check out past polls.