Isn't the array evaluated in list context and the for loop iterated over a list?
No, it's optimized. You'll notice if you add elements to the array from within the loop, the loop will iterate over them too. That's wouldn't be possible if the array had been flattened to a list (as it is in the second program below) since changing the array would have no effect on the list.
>perl -le"@a=qw(a b); for (@a) { push @a, 'c' if /a/; print }" a b c >perl -le"@a=qw(a b); for (@a,()) { push @a, 'c' if /a/; print }" a b
The maintainers will be interested in your thoughts.
I might do that for "put in context" vs "evaluated in context". The rest of the comments don't apply to the FAQ. You made bad assumptions that if the FAQ mentions something about lists, it can't be the case for arrays as well (and vice-versa).
In reply to Re^3: Lists and Arrays and Boredom
by ikegami
in thread Lists and Arrays and Boredom
by carol
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |