Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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 surveying the Monastery: (11)
As of 2015-10-07 17:53 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (194 votes), past polls