in reply to using Socket to get urls hangs for several seconds.

First, why are you not using LWP, especially LWP::Simple?

Second, in this place:

"GET $url HTTP/1.1",
why are you saying "I want protocol 1.1, including keep-alive connections", when in fact you don't want keep-alive connections?

And guess what. Fixing problem 1 would have eliminated the need to be very smart about problems like problem 2. Do not reinvent the wheel until you've studied prior art!

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.