Adding a hash to the array
my $petref = [ { "name" => "Jack",
"type" => "dog"
},
{ "name" => "Tom",
"type" => "cat"
}
];
push @{$petref},{ "owner"=>"Mary", "name"=>"Tweety"};
while(($key,$value)=each %{$petref->[2]}){
print "$key -- $value\n";
}
Related examples in the same category