I recently discovered that the $_ variable is implicitly defined in a foreach loop, like so:
@array = ('a', 'b', 'c');
foreach (@array) {
print $_;
# a
# b
# c
}
(I guess that, technically speaking, I wouldn't even have to
print $_;, I could just use
print; for the same result... but that's beside the point for my question.)
I understand that for() is more or less an alias for foreach(). So for the sake of my own knowledge, when I do this:
@array = ('a', 'b', 'c');
for ($i = 0; $i <= $#array; $i++) {
print $array[$i];
}
is there an implicit variable that would already mean
$array[$i], similar to the $_ in the foreach?
From my own testing I'm almost positive that there's not, but I wanted to make sure.