unless(param('start')){ $start = 1 } #### for(@array){ $c++; # count all items if($c >= $start){ # if $c count is = or greater than where to start $d++; # count items that match first test unless($d > $show){ # unless $d count is greater than how many to show print # or whatever } } } #### $previous = ($start-$show); unless($previous < 1){ # unless we're already at the beginning print qq~ Previous $show~; } $next = ($start+$show); unless($next > $c){ # unless we're already at the end print qq~ Next $show~; }