in reply to MySQL and Perl DBI
See the MySQL docs under the SELECT statement. You'll find the ORDER BY and LIMIT offset, rows clauses give what you want. You can keep track of position with a cgi parameter.
After Compline,Zaxo