I am trying to use the seek function to force where my second while loop
starts within file tst.txt but I see the $. Gets reset to 0 before while
(<IN>) starts.
My ultimate goal for this script is when a web page loads on my site.
The script executes, reads portions of tst.txt that have changed since
last page load and generates html from the changes.
My goal is a little different what I see in the docs about using a for
loop and having the script sleep a certain amount of time and I am
puzzled on the approach.
Any help would be appreciated;
Regards,
Dave
---Code Snip----
open (IN, "tst.txt) or die "Cannot open $file for read :$!";
my $linenum;
open (INCFG, "cfg.txt") or die "Cannot open $file for read :$!";
#Get Line number from cfg.txt
while (<INCFG>){
$linenum = $_;
}
close INCFG;
seek(IN,$linenum,0);
while (<IN>){
#do some processing
}
close IN;
#update line number in cfg.txt
open (OUT, ">cfg.txt") or die "Cannot open $file for write :$!";
print OUT $linenum;
close OUT;