my %h; { local $h{a}{b} = 1; } use Data::Dumper; print Dumper(\%h);