{ my $counter = 0; my $number_of_groups = 10; for (@files) { push(@{$groups[$counter++]},$_); $counter = 0 if ($counter == $number_of_groups); } }