in reply to lines per page
The web (and CGIs) are stateless, so "taking out the printed lines each time" isn't as easy as you think.
A better option would be to abuse the magical $. variable, that tells you which line you're on when iterating over a file handle, so if your CGI submits an offset and number of lines to display, you can do something like...
print header; my $start = param('start_line'); my $end = $start + param('show_lines') - 1; if ( open TEXT, "< /path/to/your/file.txt" ) { while ( <TEXT> ) { last if $. >= $end; print if $. >= $start; } } else { print "Oops, there was a problem!"; }
See also HTML::Pager (alt.).
--k.
|
|---|