in reply to Re^3: Erroneous defined detection of array elements
in thread Erroneous defined detection of array elements

defined does not distinguish between "never existed" and "is undef" for hash and array elements.

Neither does exist. It checks if the element currently exists, not if the element has ever existed.

Either way, so what?

I therefore consider exists a better test for unexpected auto-vivification.

That makes no sense. It doesn't prevent autovivification. It doesn't tell you whether something was autovivified or not. It doesn't help at all.

$ perl -le'{ my @a; $a[15][0]; print "After autovivification: ", exists($a[14]) || 0, exists($a[15]) || 0, defined($a[14]) || 0, defined($a[15]) || 0; }{ my @a; $a[15] = []; print "After explicit vivification: ", exists($a[14]) || 0, exists($a[15]) || 0, defined($a[14]) || 0, defined($a[15]) || 0; }' After autovivification: 0101 After explicit vivification: 0101