in reply to RE: Array of hashes not working as expected

Declare the hash inside the loop instead of outside.
Borrowing from tollic's example.

use warnings; use strict; my @array_of_hash; for (1..3) { my %hash = ( 'name' => $_, 'payment' => $_, ); push @array_of_hash, \%hash; } use Data::Dumper; $Data::Dumper::Sortkeys=1; print Dumper(\@array_of_h +ash);
Outputs:
$VAR1 = [ { 'name' => 1, 'payment' => 1 }, { 'name' => 2, 'payment' => 2 }, { 'name' => 3, 'payment' => 3 } ];