sub partition (&$@) { my $condition = shift; my $receivers_ar = shift; ref $receivers_ar or $receivers_ar = [ map [], 1..$receivers_ar ]; push @{ $receivers_ar->[ &$condition ] }, $_ for @_; @$receivers_ar } my @r = partition { $_ % 3 } 3, 0 .. 12;