http://www.perlmonks.org?node_id=997601

exilepanda has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
use Data::Dumper; $x = {}; 1 if ( exists $x->{W} ) ; 1 if ( defined $x->{X} ) ; 1 if ( $x->{Y} ) ; 1 if ( exists $x->{Y}{X} ) ; 1 if ( defined $x->{Z}{A} ); print Dumper $x;
Result :
$VAR1 = { 'Z' => {}, 'Y' => {} };
What I don't want is Z, Y create by itself, when I try to check if some keys from inner are existed or not. Can I do that ? Hopefully this won't be the only solution
if ( $x->{Y} ) { if ( $x->{Y}{Z} ) { 1 if ( $x->{Y}{Z}{A} ) ; } } ; # $VAR={};
Any clues? Thank you very much!