Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2015-07-30 06:40 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 (270 votes), past polls