can you explain what is the use of :
$| = 1;
in perl cgi program?
if I don't use it, any problem will happen?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

perldoc perlvar
                 autoflush HANDLE EXPR


                 $|      If  set  to nonzero, forces a flush right away and
                         after  every  write  or  print  on  the  currently
                         selected output channel.  Default is 0 (regardless
                         of whether the channel is actually buffered by the
                         system  or  not;  $| tells you only whether you've
                         asked Perl explicitly to flush after each  write).
                         Note  that  STDOUT will typically be line buffered
                         if output is to the terminal  and  block  buffered
                         otherwise.    Setting   this  variable  is  useful
                         primarily when you are outputting to a pipe,  such
                         as  when  you  are running a Perl script under rsh
                         and want to see  the  output  as  it's  happening.
                         This has no effect on input buffering.  (Mnemonic:
                         when you want your pipes to be piping hot.)
mwhuenAuthor Commented:
In my perl cgi program, I want to create a html and write to it, as the same time, i want to display it on the web, can i use $|=1 to accomplish my job?
mwhuenAuthor Commented:
Adjusted points to 20
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.


Note that browsers might not support 'streaming' HTML and they may also treat it differently. One might not start parsing the page at all before the entire page is downloaded. Others wil parse everytime a \n is encountered while others wait for <BR> og <P> etc... Netscape up to v. 4.7 does not render tables untill the entire table is downloaded while IE seems to attempt this.
mwhuenAuthor Commented:
I can't make it.

My code is :

print "content-type:text/html\n\n";

I expect the new.html is displayed on the screen by this CGI program.
But, It doesn't display, though new.html is created.

Of course, since there is no print to STDOUT, nothing is displayed.

Try adding

print <<XXX;

(i.e. print to both new.html and STDOUT).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.