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.