The problem is with exists creating intermediate levelsNote that, if you consider this to be a problem you can install the autovivification module, then specify no autovivification to prevent it:
Output:#!/usr/bin/env perl use strict; use warnings; use 5.010; no autovivification; use Data::Dumper; my %hash = ( a=>{} ); if ( !exists $hash{'a'}{'b'}{'c'} ){}; print Dumper \%hash;
This is, however, apparently not an option for the OP, due to short-sighted customer requirements and autovivification is an XS module, so using its code independently of the original module would be a bit more involved than just copy/pasting the source.$VAR1 = { 'a' => {} };
In reply to Re^2: Why are Hash keys different for the same hash? Confusing.
by dsheroh
in thread Why are Hash keys different for the same hash? Confusing.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |