On Mon, 17 Sep 2001, Rasoul Hajikhani wrote:

> Hi there,
> is there any way to know what is the "current" index value in a foreach
> loop?
>
> EX:
>
> foreach my $var (@array)
> {
>         # need the index of the array
> }

Just index through the array this way:

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

        #array index is $var
}

-- Brett
                                          http://www.chapelperilous.net/
------------------------------------------------------------------------
"MSDOS didn't get as bad as it is overnight -- it took over ten years
of careful development."
(By [EMAIL PROTECTED])


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to