Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1077742]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2018-04-23 09:59 GMT
Find Nodes?
    Voting Booth?