# "Can't use an undefined value as an ARRAY reference": # @{$$n{'x'}} and die; print "\n\nnow the same but in loop:\n"; for my $e (@{$$n{'x'}}) { } print "why 'x' autovivified?\n"; print Dumper $n;
Well you get right the same effect without disabling autovivification.
While it feels like autovivification there's IMHO technically an aliasing/for-loop magic happening. This is probably not covered by the internal autovivification mechanisms (i.e. explicitely accessing sub-elements) and hence was forgotten.
Not sure if it's easy to implement, but you should commit a bug report to raise the question.
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
In reply to Re: No autovivification, for loop aliasing, lvalue vs rvalue in for loops
by LanX
in thread No autovivification, for loop aliasing, lvalue vs rvalue in for loops
by leszekdubiel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |