in reply to Server waits for user input before sending text.
I just read about this in Network Programming with Perl. It's written by Lincoln Stein (the author of CGI.PM). You can find out more about the book at his site.
There's a sample script that deals with your issue by using fork. Check it out here