in reply to Flushing the print buffers.
I guess you got a "Name "main::OUTPUT_HANDLE" used only once: possible typo" warning with the code you posted
Try
my $old_fh = select(STDOUT); $| = 1; select($old_fh);
- The first select changes the default output filehandle to STDOUT and returns the current default output filehandle to be saved in $old_fh.
- $|=1 turns on autoflushing on the current output filehandle
- select($old_fh) restores the original output filehandle
Generally, if you just want to turn on autoflushing on STDOUT, a simple $|=1 will do.
In Section
Seekers of Perl Wisdom