in reply to Autovivification Confusion

But shouldn't Perl have interpreted this
my $count{'abc'};
as
my %count = ( 'abc' => undef );
This is how I understand how autovivification works.

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

    Yes, if my $count{'abc'}; made sense, that could be an expected result. He had my $count{'abc'} = 0;, though, which is why he's expecting a different result.

    This is how I understand how autovivification works.

    autovivification is the automatic creation of variables when they are needed.

    No part of the OP's file contains code that uses %count (just $count), so it's never needed, so autovivification has nothing to do with the OP's problem.