print map { @$_, "\n" } split_into_three( 'a'..($ARGV[0] || 'z') ); sub split_into_three { my @a = @_; my (@b, @c); while (@b < @a) { push(@b, shift(@a)); unshift(@c, pop(@a)); } push(@a, shift(@c)) if (@a < @c); return \@b, \@a, \@c; }