use integer; @n = map { $n + 1 - $_, $_ } 1 .. $n / 2; push @n, $n / 2 + 1 if $n % 2;