for( my $i=0; $i < $#vidids; $i += 50 ) { my @counts = @vidids[ $i .. $i + 50 ]; ## use @counts... } ## or avoid the copy and use the slice directly.