Perl Split Array Into Smaller Arrays

[Solved] Perl Split Array Into Smaller Arrays | Perl - Code Explorer | yomemimo.com
Question : perl split array into smaller arrays

Answered by : australian-magpie-dct18n5nrtkk

 my @array = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); my $numberofarrays = 10; my @splitArray; while (@array) { foreach (0..$numberofarrays-1){ if (@array) { push @{$splitArray[$_]}, shift @arrays; } } }

Source : | Last Update : Fri, 13 Dec 19

Answers related to perl split array into smaller arrays

Code Explorer Popular Question For Perl