in reply to Traversing succeding sets of an array
do_something_with($elements[$_-1], $elements[$_]) foreach (1 .. $#elements); [download]