http://www.perlmonks.org?node_id=504580


in reply to Re: Converting HoA into AoH
in thread Converting HoA into AoH

I am surprised no-one else complained yet, but this addresses only the example using hard coding, which cannot be useful to the OP given that the number of nesting levels of your loops translates to the number of families. It should be obvious that a solution should be generic to handle a variable number of set-of-sets of unpredisclosed group names each containing an unpredisclosed number of members each with unpredisclosed names.

Update and I should have added that, Algorithm::Loops, which someone has already mentioned, handles precisely the situation where loop nesting level is variable, although I am personally more inclined towards the explicit recursion solutions that were also offered in response.

-M

Free your mind

Replies are listed 'Best First'.
Re^3: Converting HoA into AoH
by Anonymous Monk on Nov 01, 2005 at 16:27 UTC
    I am surprised no-one else complained yet
    It's out of courtesy, that nobody complained...