in reply to How to close connection to browser

First of all, this isn't a Perl question. It's a CGI question; both the question and the answer are language independent.

Second, it's not the CGI program that talks to the browser. A CGI program communicates with the server. So, you have to signal to the server you are ready sending output, and then the server can go on its merry way. Some servers will not send anything to the browser before they have collected all the output from the program - if only they want to sent a Content-length header. Signalling can often be done by closing stdout and stderr.

Third, nowadays browsers and servers don't close the connection automatically right after sending the content of a single request - this is called the keepalive feature.

Abigail