Offer Kaye <mailto:[EMAIL PROTECTED]> wrote:
: 
: 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 );
}



HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to