in reply to checking file everytime a new line is added to file
You could also use some combination of seek and tell to emulate a tail -f (although you are probably better off using File::Tail) Basically, you open the file for reading, process all the lines, sleep a little, run seek to clear the EOF flag (without moving the cursor, such as seek(MYFILE,0,1)) and then trying to read in a line again (e.g. with <>) You could also use tell to save where you are in the file, and seek to that spot upon reopening it. Or use -s $filename to keep re-checking the size of the file. Definitely MTOWTDI!
|
|---|