use strict; use warnings; my @array = (1 .. 8); my @other; while (@array) { push @other, @array[-1, 0, 1, -2]; splice @array, 0, 2; splice @array, -2, 2; } print "@other";