in reply to dynamic links with perl/cgi?

I just wrote something like that today.

The code flow went something like this:

if we haven't seen all the matches yet create a link to the next 50 if we're not starting at the 0th match create a link to the previous 50
To do this, I passed a param named 'next', just as you describe:

my $url = "$ENV{SCRIPT_NAME}/?next=$next";

I used $next as a parameter to the MySQL LIMIT command. If it's not passed as a parameter, I set it to zero.