use strict; use warnings; my @orig = 1..17; my $arrs = 4; my @arrs; ##### And here we go: ##### push @{$arrs[$_ % $arrs]}, $orig[$_] for 0..$#orig; print join ' ', @$_, "\n" for @arrs;