for my $i (0..$#array) { do_something_with($array[$i], $i); }