Greetings, I want to read through a file, go to sleep and then check if new records were written to the file. If yes I want to process the records, if no go back to sleep and check again later (in a forever loop).
I thought I could do something like this but after it reads the file the first time through the while, it never seems to pick up the new records added to the file.
open (LOG, "<log_file") or die ("could not open log_file");
for (; ;)
{
print "Record Number == $.\n";
while ($text=<LOG>)
{
chomp ($text);
print "$text\n";
}
sleep (60);
}
close (LOG);
After reading the file originally the above script just keeps printing the record number of the last record in the file. I saw somethng about a TailFile package available but it appears I don't have it and it would be difficult to get loaded at this time. I am hoping for a vanilla perl solution.
Thanks in advance.