Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: array of arraysby dreadpiratepeter (Priest) |
on Jun 29, 2009 at 13:06 UTC ( [id://775653]=note: print w/replies, xml ) | Need Help?? |
the syntax is wrong, what you need is @aod[$id] would be a 1 element array slice. with @{$aod[$id]} you are saying that the scalar in position $id in your outer array, is to be used as a reference to an array. Since push needs to be passed an array, not a reference, you use the dereferencing syntax @{} to give it what it needs. The first time you push on a particular element the nested array gets auto-vivified, that is automatically created when needed. -pete "Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."
In Section
Seekers of Perl Wisdom
|
|