foreach (@array) { do_something_with($item, state i++); }