Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Output to file is not flushing immediately
March 25, 2008, 8:19 pm
rate this thread
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
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.
Re: Output to file is not flushing immediately
That will only turn autoflush on for the STDOUT (or whatever the currently
selected filed handle is).
Read all about it here:
perldoc -q flush
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate