in reply to what's with last;

There is a difference between calling a routine httpserv and actually writing a http server. My guess is that you receive a Connection: keep-alive header (which you discard) and thus your first code tries to read forever from the socket. The second snippet of code never reads the headers sent by the browser and hence is fast.

I suggest you look into using HTTP::Server::Simple if you want a simple HTTP server, or in the code I have here, Simple HTTP in under 100 lines.

Update: Also see last as to what last does.