use constant NUM_ELEMENTS => 15;
# Get the starting_array from somewhere
my @starting_array = populate_somehow_with_data();
my $start_index = 0;
while ($start_index <= $#starting_array)
{
my $end_index = $start_index + NUM_ELEMENTS - 1;
$end_index = $#starting_array if $end_index > $#starting_array;
my @array_slice = @starting_array[$start_index .. $end_index;
$start_index += NUM_ELEMENTS;
# use @array_slice here to do what you need to do.
}
------ We are the carpenters and bricklayers of the Information Age. The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6 Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified. |