in reply to how to seperate array after a certain number of elements?

splice can be used to extract elements from an array.

my @myArray = (1..100); my @myMainArray; while (@myArray) { push @myMainArray, [ splice(@myArray, 0, 5) ]; } foreach my $record (@myMainArray) { print(join(', ', @$record), "\n"); }

Update: Fixed typo bug in code. Thanks ww.