in reply to Lowering my STDards :)
Why do I have to do all that selecting of file handles? If STDOUT is already selected by default, and I'm not changing to another handle, can't I just use...
Yes, presuming you know beyond a shadow of a doubt that STDOUT is already selected. The code you quoted takes care of the possibility that STDOUT is not the currently selected handle, but that you want to to autoflush STDOUT regardless of which handle is currently selected
But if theres a flush(STDOUT) function, I haven't seen it documented
Functions that take Handles as arguments tend to be very perl4esque, and not many have been added in a while. There is a more OO mechanism for dealing with handles in the IO::Handle class, which includes an flush method...
my $io = IO::Handle->new_from_fd(fileno(STDOUT),"w")) ... $io->print(...); ... $io->flush(); ...
|
|---|