in reply to Autovivification Confusion
The error you're getting is not because %count doesn't exist.
$ perl -e'my $count{abc};' syntax error at -e line 1, near "$count{abc" Execution of -e aborted due to compilation errors. $ perl -e'my %count; my $count{abc};' syntax error at -e line 1, near "$count{abc" Execution of -e aborted due to compilation errors.
Therefore, the issue isn't a lack of autovivification. If it somehow made sense to do my $count{'abc'}, you might be right that %count should be autovivified.
What you are trying to achieve can be done using
my %count = ( abc => 0 );
|
|---|