G
Guest
I have a perl script that writes stuff to a text file. While the
script is running, I do a "tail -f" on the text file to see the
output. But I can tell that the output isn't being flushed
immediately, because the script writes something to the file
immediately before sleeping for 60 seconds, but I don't see that
output show up in the "tail -f" until after it comes back from
sleeping.
I thought that putting a "\n" at the end of a print would do a flush,
but that's obviously not the case.
I also read that if you put "$| = 1" at the beginning of your script,
then it would do a flush after every print or write command. I tried
that, and it still does not flush.
script is running, I do a "tail -f" on the text file to see the
output. But I can tell that the output isn't being flushed
immediately, because the script writes something to the file
immediately before sleeping for 60 seconds, but I don't see that
output show up in the "tail -f" until after it comes back from
sleeping.
I thought that putting a "\n" at the end of a print would do a flush,
but that's obviously not the case.
I also read that if you put "$| = 1" at the beginning of your script,
then it would do a flush after every print or write command. I tried
that, and it still does not flush.