#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %hash; if (exists $hash{a} && exists $hash{a}{b}) {} print "Case 1 without autovivication:\n" , Dumper \%hash; if (exists $hash{a}{b}) {} print "Case 2 with autovivication:\n" , Dumper \%hash;