Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: what is the meaning of $| in perl?

by eyepopslikeamosquito (Chancellor)
on Mar 10, 2014 at 19:13 UTC ( #1077742=note: print w/ replies, xml ) Need Help??

in reply to what is the meaning of $| in perl?

Now that you know what $| is, I suggest you don't use it.

Instead of your global LOGFILE file handle and:

select(LOGFILE); $| = 1; select(STDOUT);
it is preferable to use a lexical file handle ($logfile say) for your log file and then simply:
use IO::Handle; # ... $logfile->autoflush();

With recent Perls (5.8+), there's no need anymore to confusingly change the (global) default destination for print statements via the one-argument form of select -- for more details, see Perl Best Practices, chapter 10 and Perl tip: Buffering and IO::Handle (for Perl 5.14+ you don't need use IO::Handle).

Comment on Re: what is the meaning of $| in perl?
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2015-11-30 05:01 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (758 votes), past polls