in reply to Why is this script not giving real-time output to browser?

It sounds like you still have buffering on. Have you turned off buffering using

$| = 1;

I did a quick search on the internet and this URL should be useful.

Unless I'm missing something obvious, this should help.