http://qs321.pair.com?node_id=672330


in reply to Re: Hash of Arrays (populating and iterating)
in thread Hash of Arrays (populating and iterating)

Or this way -- why bother with indexes at all?
foreach $animal ( @{ $animals{pets} } ) { push ( @some_animals, $animal ); }


Nobody says perl looks like line-noise any more
kids today don't know what line-noise IS ...

Replies are listed 'Best First'.
Re^3: Hash of Arrays (populating and iterating)
by USP45 (Novice) on Mar 06, 2008 at 14:41 UTC
    That's true. I tried it that way at first and got unexpected results (the array getting treated as 1 item when I tried to sort and make the elements unique) but it's probably because I was using qq incorrectly to populate the hash in the first place. I should have used qw and the elements would have been separate elements.