The question has been answered already. I thought I would add a little bit more explanation.
When we write %hash = ('a', 'b', 'c', 'd'); this is the same as saying %hash = ('a' => 'b', 'c' => 'd'); because the => are just fat commas. So, when you push the hash onto an array, push @AoH, %hash this is just the same as push @AoH, ('a', 'b', 'c', 'd'); which will simply push the elements one by one onto @AoH, losing the structure of the hash or array that you are pushing.
Small technical point. You don't know if at the end of this you get @AoH = ('c', 'd', 'a', 'b'); or @AoH = ('a', 'b', 'c', 'd'); because the ordering of the keys in a hash is arbitrary.
This is the whole reason why references were added in Perl 5.
In reply to Re: Generate Array of Hashes WITHOUT References
by b4swine
in thread Generate Array of Hashes WITHOUT References
by tel2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |