my $data=decode_json($rawdata); # print Dumper($decoded); for ( @{ $data->{sections} } ) { # This line works; prints the 4 titles (one from each section) print $_->{title}."\n"; # No image info' in file anyway, so no output expected, but not sure if code is correct for ( @{ $_->{images} } ) { print $_."\n"; } # Nothing gets printed, but no error (figure it should print something from top section) print $_{content}->{text}."\n"; # This fails with "Not a hash reference" # for ( @{ $_->{content}->{elements} } ) # { # print $_->{text}."\n"; # } } #### $VAR1 = { 'sections' => [ { 'images' => [], 'level' => 1, 'content' => [], 'title' => '10-minute Turkey' }, { 'images' => [], 'level' => 2, 'content' => [ { 'text' => 'Makes 4 servings.', 'type' => 'paragraph' } ], 'title' => 'Description' }, { 'images' => [], 'level' => 2, 'content' => [ { 'elements' => [ { 'elements' => [], 'text' => 'abc' }, { 'elements' => [], 'text' => 'efg' }, { 'elements' => [], 'text' => 'hij' }, ], 'type' => 'list' } ], 'title' => 'Ingredients' }, { 'images' => [], 'level' => 2, 'content' => [ { 'elements' => [ { 'elements' => [], 'text' => 'tuv' }, { 'elements' => [], 'text' => 'wxy' }, { 'elements' => [], 'text' => 'z12' }, ], 'type' => 'list' } ], 'title' => 'Directions' } ] };