in reply to Re: Struggling with complex data structures and doing useful operations on their elements and populating from arrays
in thread Struggling with complex data structures and doing useful operations on their elements and populating from arrays

each scalar $infoi are each intended as a row in @info

  • Comment on Re^2: Struggling with complex data structures and doing useful operations on their elements and populating from arrays

Replies are listed 'Best First'.
Re^3: Struggling with complex data structures and doing useful operations on their elements and populating from arrays
by marinersk (Priest) on Mar 12, 2015 at 14:22 UTC

    You may name the loop control scalar anything you like.

    You asked how to loop. I am showing you some basic techniques, and some common problems with the basic techniques, so you grasp the whole problem and, hopefully, see a path to the whole solution.

Re^3: Struggling with complex data structures and doing useful operations on their elements and populating from arrays
by marinersk (Priest) on Mar 17, 2015 at 22:04 UTC

    Okay, it looks like nobody else will answer your question, and you won't answer mine.

    In the interest of helping a future Hash/Array Perl newcomer who might want to see the problem from the same angle you are seeing it, here's the solution I would have worked you toward.

    You can ask about anything here, but I'm not likely to check this thread anymore.

    Hope this helps.

    And here's the subroutine I used to try and make the operation a little more clear:

    I would also point out that in my copy, I wrote a series of unit tests into this routine, because it was just complex enough to warrant that level of care -- and those tests caught a bug I had introduced into the code. Root cause? Sheer arrogance. Good engineering practices protect us from many things, but most of all from ourselves.