my @a = (0 .. 25); sub c{$_[0] % 3 == 0 } sub S{my@t;push@{$t[c($_)]},$_ for@_;@t} my($l,$r)=S(@a); print "@$l\n"; print "@$r\n";