... I don't understand what "for my $i (0 .. $#arr)" means ...
The other point to remember about this type of loop (a so-called Perl-style for-loop) is that is "topicalizes" (see "topic" in perlglossary) $i or whatever variable you specify, or implicitly $_ if you don't explicitly specify any variable, to each element of the loop list; see Foreach Loops in perlsyn. Also note that foreach and for are exactly synonymous and completely interchangeable keywords in Perl; the differing behavior of Perl- and C-style for/foreach-loops is determined by the syntax of the loop list expression.
Give a man a fish: <%-{-{-{-<
In reply to Re^3: Array value changing for some reason
by AnomalousMonk
in thread Array value changing for some reason
by Silt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |