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