go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
FYI, you can edit your original post to clarify with an Edit: blah blah Whenever you have multiple elements that are mysteriously identical, you've almost certainly got two references to the same thing in your set.
%hash is declared somewhere outside of the code you posted. Inside your loop, you push a reference to that hash onto your array. You then push more references to the SAME hash until the loop ends. If you want different, independent hashes in each array element, then push @AoH, {Section=>$sec, Subsection=>$subsec, foo=>$bar}; to get references to a new anonymous hash each time. Alternatively, you can do a deep copy on a template hash before tweaking it and putting a ref to the new copy into your array In reply to Re: building array of hashes
by SuicideJunkie
|
|