my $petref = [ { "name" => "Jack", "type" => "dog" }, { "name" => "Tom", "type" => "cat" } ]; print "$petref->[0]->{name}.\n"; for($i=0; $i<2; $i++){ while(($key,$value)=each %{$petref->[$i]} ){ print "$key -- $value\n"; } print "\n"; }