in reply to Autovivification Confusion

Your first example is a hash slice but no hash was declared. In your second example, you declared the hash, but that's not autovivification. Autovivification is the automatic creation of a variable reference when an undefined value is dereferenced. Maybe this example will help:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper::Concise; my $hash = { 'foo' => { 'abc' => 0, }, 'bar' => { 'def' => 1, }, }; print Dumper($hash) unless exists $hash->{'baz'}{'ghi'},
'baz' doesn't exist, so perl creates it---autovivification.

Replies are listed 'Best First'.
Re^2: Autovivification Confusion
by ikegami (Patriarch) on Aug 05, 2011 at 19:32 UTC

    'baz' doesn't exist, so perl creates it---autovivification.

    In the docs, autovivification refers to the creation of %{ $hash->{'baz'} }, but it's definitely acceptable to consider the creation of $hash->{'baz'} autovivification as well. Both happen here.