in reply to building array of hashes

Since you do not declare your hash inside of your for loop, it is always the same one you push into the array. You do not have a new one with new values, you just replace them.

There are two things you can do. Either declare your hash lexically (with my) inside the for loop, and you'll have a brand new one each time, or youcan make a new one to push into AOH. With push @AOH, { %hash }; # copy of %hash here

Both are possible, but it would probably be better to have your my %hash in the for loop, because you can be sure to have only new values, not ones that you somehow didn't delete or change.