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