my $offset = $q->param('offset'); $offset ||= 0; print "

$_

" foreach (@results[ $offset .. ($offset + $max) ]);