for i, item in enumerate(array): do_something_with(item, i) #### my @idx = 0 .. $#array; pairwise { do_something_with($b, $a) } @idx, @array;