$ perl -E 'my @a=1..5; for my $i(1..$#a) { say "$a[$i-1], $a[$i]" } ' 1, 2 2, 3 3, 4 4, 5