Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/perl/bin/perl use strict; use warnings; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use File::Find; print header(); my $v_file; # get the last $pos from somewhere # It should read lines from any text file. my $path = "testme.txt"; my $pos = 0; print "Just to see the value of:***$pos ****"; open VIEWFILE, "< $path" or die "Can't open $path: $!<br>\n"; seek (VIEWFILE, $pos, 0) or die "Couldn't seek to $pos: $!<br>\n"; my $n_counter = 0; my $count = 100; while( defined($v_file = <VIEWFILE>) and $count--) { print "<div STYLE=\"font-family: Courier, 'Courier New', monospa +ce; font-size:.7em;\">$v_file</div><br>"; } if($v_file){ print "<br><center><a href=\"parse_test.pl?pos=$pos\"><font color=#ad0 +000><b>more >>></b></font></a></center>"; }else{ print "End"; } # save $pos somewhere for the next page view #How actualy save this, where could I do this? $pos = tell(VIEWFILE); close VIEWFILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Show Next Lines of a Text File
by Anonymous Monk on May 12, 2006 at 14:48 UTC |