in reply to How do I write a simple webserver

If you just want to accomplish the task, use HTTP::Daemon.

If you want to study how it's done, read the source code of that module. {grin}

-- Randal L. Schwartz, Perl hacker