You're just falling into autovivification. Check for existence of the lower level first if you don't want it autocreated:
use Data::Dumper; $x = {}; 1 if ( $x->{Y} && exists $x->{Y}{X} ) ; 1 if ( $x->{Z} && defined $x->{Z}{A} ); print Dumper $x;
In reply to Re: How do you check if a key exists without creating it ?
by wind
in thread How do you check if a key exists without creating it ?
by exilepanda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |