in reply to Traversing succeding sets of an array

This may be one of those cases where an incremented index variable is useful:
for my $i (0..$#elements-1) { do_something_with($elements[$i],$elements[$i+1]); }