#! 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');