According to Addison Wesley's "Network Programming with Perl" book your program should do the following:
.
For anyone wanting to download the example source code you want Chapter 10 (for anyone reading the book, it starts on page 312). Looks like the author (Lincoln D. Stein, the author of CGI.pm) uses the POSIX module mentioned above.
-- Argel