Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Pushing Array ref to arrayby hardburn (Abbot) |
on Feb 01, 2012 at 16:15 UTC ( [id://951258]=note: print w/replies, xml ) | Need Help?? |
The problem is that each entry in @result is a reference to @row, but because @row is declared at the top of the code, you change the contents of @row each time through. Instead, you need to create a new variable each time through the loop. This is quite easy:
And you should be able to delete the my @row; line at the top of the code. Here's something that may help you understand better: Lexical scoping like a fox. "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.
In Section
Seekers of Perl Wisdom
|
|