Splitting an array into two or three are special cases where you can simply use stack operations.
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; }
In reply to Re: Filling buckets
by eg
in thread Filling buckets
by meonkeys
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |