that's sets the *current* default file handle to auto-flush -- so if you want to set anything but STDOUT to auto-flush you have to do something like
open(LF,">log_file.txt" || die "error, $!\n";
select(LF); $|=1; Mike
________________________________________________________________
"Experience is the comb that Nature gives us, after we are bald."
Is that a haiku?
I never could get the hang
of writing those things.
I encountered this exact same need last Wednesday. I was most comfortable using the following method, which is included as part of the standard perl distribution... also, I feel that it's a bit more indicative of the intent, rather than doing multiple selects in your code:
Code:
use IO::Handle;
open(FILE, ">>somefile.txt");
FILE->autoflush(1); # This is the magic.
# and then continue on with your day...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.