toolic and fishmonger have already provided a solution to your problem, but in case you want to know what the problem was: you are pushing a reference to the very same hash onto your array every time, overwriting its contents every time. This is exactly what you see in the output of Data::Dumper. toolic's and fishmonger's approaches both create a new hash in each iteration and store a reference to that new hash in the array.
In reply to Re^2: Array of hashes not working as expected
by hdb
in thread RE: Array of hashes not working as expected
by lonewolf28
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |