Hi Everyone.
In perl 5.8.5, if I do the following, I don't get an error:
use strict;
my $a = undef;
foreach my $el (@$a) {
...whatever
}
What's going on here? Printing out the output of ref($a)
shows that $a
changes to become a valid array reference at some point. But I never explicitly set $a
to anything.
Seems kind of odd that the contents of a variable could change without me doing anything.
Thoughts, anyone?
EDIT: Yes, I know all about auto-vivification. I always thought that there had to be a assignment somewhere along the way to trigger it, not just a reference.