in reply to No autovivification, for loop aliasing, lvalue vs rvalue in for loops
# "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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: No autovivification, for loop aliasing, lvalue vs rvalue in for loops
by leszekdubiel (Scribe) on Sep 02, 2016 at 20:36 UTC | |
by leszekdubiel (Scribe) on Sep 02, 2016 at 20:39 UTC | |
by Anonymous Monk on Sep 02, 2016 at 21:27 UTC |