use strict; use warnings; # perl 5.10 only used for say() and infix // use 5.010; my $size = shift(@ARGV) // 6; for my $turn (0.. ($size - 2)) { my @players; @players[0..($size-1)] = ((1) x $size); for (0 .. ($size / 2 - 1)) { my $current = $_; $current = ($current + 1) % $size until $players[$current]; $players[$current] = 0; my $other = ($size - $turn - $current - 1) % $size; $other = ($other - 1) % $size until $players[$other]; $players[$other] = 0; say $current + 1, '-', ($other + 1); } say '=' x 10; }