I am trying to tail a file. I used the example from perlfaq5 and it works just fine if I tail a file in my /tmp/ dir. However if I move that same file to any other dir, the script just reads to the end of the file. If I write a little more to that file, then save, the script will not output it. I am assuming this is because eof cannot be reset for some reason. Any ideas?? I think this should be reproducible.
open (GWFILE, "/tmp/logfile");
#open (GWFILE, "/opt/logfile");
for (;;) {
my $curpos;
for ($curpos = tell(GWFILE); <GWFILE>; $curpos = tell(GWFILE)) {
print;
}
# sleep for a while
sleep 1;
seek(GWFILE, $curpos, 0); # seek to where we had been
}