in reply to Filling buckets
sub split_into_three { my $first = @_; my $last = int($first / 3); $first -= $last; $first -= int($first / 2); return [ @_[0..$first-1] ], [ @_[$first..$#_-$last] ], [ @_[$#_-$last+1..$#_] ]; } my ($first, $second, $third) = split_into_three(@everything); my @buckets = split_into_three('a'..'z'); print join("\n", map { join(" ", @{$_}) } @buckets), "\n"; # a b c d e f g h i # j k l m n o p q r # s t u v w x y z
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Filling buckets
by Fastolfe (Vicar) on Jan 03, 2001 at 08:42 UTC | |
by t'mo (Pilgrim) on Jan 03, 2001 at 20:02 UTC |