Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Flushing the print buffers.

by FunkyMonk (Canon)
on Feb 21, 2008 at 19:58 UTC ( #669375=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: Flushing the print buffers.
Select or Download Code
Re^2: Flushing the print buffers.
by kansaschuck (Sexton) on Feb 23, 2008 at 06:01 UTC
    This worked nicely:
    my $old_fh = select(STDOUT); $| = 1; select($old_fh);
    Thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://669375]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (17)
As of 2015-07-02 18:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls