: Neither was I, but I suspect the reason is that if you need a
: counter, you should not be using "foreach". Instead, use "for":
: for(my $counter = 0; $counter < @array; ++$counter) {
: do_something_with($array[$counter]);
: }
Why is that form favored over this typical foreach form?
foreach my $counter ( 0 .. $#array ) {
do_something_with( $counter );
}
or that way w/ for (and why declare a new var only to use it once...)
do_something_with($_) for(0..$#array);
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>