perl split array into smaller arrays
my @array = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
my $chunk_size = 3;
my @smaller_arrays;
while (my @chunk = splice @array, 0, $chunk_size) {
push @smaller_arrays, \@chunk;
}
foreach my $small_array_ref (@smaller_arrays) {
print join(', ', @$small_array_ref) . "\n";
}