#! perl use strict; use warnings; print "\nWITH autovivification:\n"; my $hashref1; printf "1. \$hashref1 %s defined\n", (defined $hashref1 ? 'IS' : 'is NOT'); my $foo = $hashref1->{bar}; printf "2. \$hashref1 %s defined\n", (defined $hashref1 ? 'IS' : 'is NOT'); no autovivification; print "\nWITHOUT autovivification:\n"; my $hashref2; printf "3. \$hashref2 %s defined\n", (defined $hashref2 ? 'IS' : 'is NOT'); my $baz = $hashref2->{bar}; printf "4. \$hashref2 %s defined\n", (defined $hashref2 ? 'IS' : 'is NOT'); #### 0:43 >perl 830_SoPW.pl WITH autovivification: 1. $hashref1 is NOT defined 2. $hashref1 IS defined WITHOUT autovivification: 3. $hashref2 is NOT defined 4. $hashref2 is NOT defined 0:43 >