On Fri, 29 Jun 2001, Bob Mangold wrote:

> Is there a perl variable that automatically counts loop iterations. Such that I
> don't have to use '$count':
>
> foreach (@array){
>   $count++;
>   ..whatever..
> }

You can always do, if you need a loop variable:

foreach my $i (0..$#array) {

        #do stuff with $array[$i]

}

-- Brett

                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
At times discretion should be thrown aside,
and with the foolish we should play the fool.
                -- Menander

Reply via email to