Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by vinoth.ree (Parson)
on Mar 11, 2014 at 08:52 UTC ( #1077815=note: print w/ replies, xml ) Need Help??


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

Whenever you print data on a filehandle, it will be buffered and the data will not be availale in the file, until the buffer get full.

In Perl, we can not turn the buffering off, but you can get the same benefits by making the filehandle hot.

Here in you code select(LOGFILE); make the LOGFILE filehandle to be selected and $|=1, which is the special variable in perl, If you set it to a true value, it makes the current filehandle hot. So Perl will flush the data in the buffer immediately once you print on that filehandle.select(LOGFILE); select will return the currect filehandle.


All is well


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://1077815]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-10-25 17:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (147 votes), past polls