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]
- Index of foreach Rasoul Hajikhani
- Re: Index of foreach Brett W. McCoy
- Re: Index of foreach P lerenard
- Re: Index of foreach Andrea Holstein
- Re: Index of foreach Brett W. McCoy
- Re: Index of foreach Andrea Holstein
- Re: Index of foreach Brett W. McCoy
- Re: Index of foreach Rasoul Hajikhani
- Re: Index of foreach Andrea Holstein
