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
> }
> 
> Thanks in advance.
> -r

Try
for (my $i=0, my $var = $array[$i]; $i < @array; $i++, $var =
$array[++$i]) {
   ...
}

Greetings,
Andrea

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

Reply via email to