in reply to RE: Array of hashes not working as expected
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.
|
|---|