$ perl -Mstrict -MData::Dumper -wE ' my $h; $h->{foo}->{bar}->{baz} = "qux"; say Dumper $h; say( (exists $h->{foo}->{bar}->{baz}) ? 1 : 0 ); say( (exists $h->{foo}->{NOT} && exists $h->{foo}->{NOT}->{baz}) ? 1 : 0 ); say Dumper $h; ' $VAR1 = { 'foo' => { 'bar' => { 'baz' => 'qux' } } }; 1 0 $VAR1 = { 'foo' => { 'bar' => { 'baz' => 'qux' } } };