Hello all
While traversing a loop across and array, how can I access array
positions further down the array, like say if I am on a loop looking at
position 23, how can I check the value of say position 24 or 32 while my
loop counter is on position 23.
for my $index (0..$#array) { do_something( $array[$index] ); # where we are now do_something( $array[ $index + 1 ] ); # ahead one do_something( $array[ $index - 10 ] ); # behind ten # etc... }
Hope that helps.
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>