[EMAIL PROTECTED] wrote:
> 
> Hello, All:

Hello,

> When using foreach or while() on an array, how can I access the index of
> the list that foreach()/while() is working upon? Is there an internal
> variable that stores this info like PHP's current()?

No, Perl doesn't have a variable like that, you have to create your own.

for my $index ( 0 .. $#array ) {
    $array[$index] = 'something';
    }

for ( my $index = 0; $index < @array; ++$index ) {
    $array[$index] = 'something';
    }

my $index = 0;
while ( $index < @array ) {
    $array[$index] = 'something';
    }
continue {
    ++$index;
    }



John
-- 
use Perl;
program
fulfillment

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

Reply via email to