The stupid question is the question not asked | |
PerlMonks |
Re: Why doesn't this die with "Can't use an undefined value as an ARRAY reference"?"by haukex (Archbishop) |
on Oct 18, 2017 at 18:57 UTC ( [id://1201611]=note: print w/replies, xml ) | Need Help?? |
Interesting... a minimal test case is the following, which throws the "Can't use an undefined value as an ARRAY reference" error in all Perl releases from 5.6 to 5.20, but doesn't cause an error in Perl 5.22 thru 5.26.
It apparently has something to do with that specific call, since the following two always fail:
A bisect boils this down to commit 569ddb4a: "scalar($#foo) needs to propagate lvalue context" and perl5220delta says: "scalar() now propagates lvalue context, so that for(scalar($#foo)) { ... } can modify $#foo through $_." The following two don't cause any failures on any release from 5.6 to 5.26, and in both cases cause the hash entry 100=>[] to autovivify:
So the change to scalar in 5.22 is simply passing the autovivification behavior through.
In Section
Seekers of Perl Wisdom
|
|