>>170
テキトーだけどこんな感じ

# 結果を表示
$i++;



# 結果を表示
$i++;
next if($i < $in{gaisyutu});
if($i > 数件){
print "<a href="URL?gaisyutu=$i&検索条件色々">次</a>"
last;
}