in reply to problem in Pushing to Array of hash
There is only one %resultarray and it lives as long as any of you other variables -- each time you take a reference, its to the same variable
The shortest fix is to use
push @AoH, { %resultarray };
To learn how to avoid this problem see:
Tutorials: Getting Deeper Into Perl: Variable Scoping in Perl: the basics
Tutorials: Getting Deeper Into Perl: Coping with Scoping
For an example of the same problem see parse xml and store data in array of hashesh
|
|---|