http://www.perlmonks.org?node_id=1090334


in reply to Why will referencing an undefined value as array reference create a real array

That's a feature called auto-vivification. Consider the following alternative:

print "this won't be printed\n" if (scalar @{$test} and scalar @{$test +}[0]);

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^2: Why will referencing an undefined value as array reference create a real array
by mfort (Novice) on Jul 28, 2014 at 15:46 UTC
    Thanks for pointing me to the Auto Vivification. I swear I learn something new every day with perl and I've been using it for decades now.