in reply to Re: Why are Hash keys different for the same hash? Confusing.
in thread Why are Hash keys different for the same hash? Confusing.

The problem is with exists creating intermediate levels
Note that, if you consider this to be a problem you can install the autovivification module, then specify no autovivification to prevent it:
#!/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;
Output:
$VAR1 = { 'a' => {} };
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.

Replies are listed 'Best First'.
Re^3: Why are Hash keys different for the same hash? Confusing.
by Anonymous Monk on Feb 28, 2016 at 10:20 UTC
      Oooh... Nice! That actually solves something that's come up in one of my work projects recently. Thanks!