I have a fixed-sized array where the size of the array is always in factor of 3.
my @array = (\'foo\', \'bar\', \'qux\', \'foo1\', \'bar\', \'qux2\', 3, 4, 5
my @VAR; push @VAR, [ splice @array, 0, 3 ] while @array;
or you could use natatime from List::MoreUtils
use List::MoreUtils qw(natatime); my @VAR; { my $iter = natatime 3, @array; while( my @tmp = $iter->() ){ push @VAR, \@tmp; } }