Depends on the nature of your application, you may want to consider mod_perl. LWP::UserAgent requires a new thread/process for each session in a multi-user environment. If your site is "hot", and may get many hits within a minute, LWP::UserAgent is absolutely not a choice.
Anyway, the following piece of code receives the response, and parse the header into a hash.
use IO::Socket::INET;
use Data::Dumper;
use strict;
my $s = new IO::Socket::INET(Proto => "tcp",
PeerAddr => "www.yahoo.com",
PeerPort => 80)
|| die "failed to new socket\n";
print $s "GET http://www.yahoo.com HTTP/1.1\r\nHost: www.yahoo.com\r\n
+\r\n";
my $response;
while (<$s>) {
chomp;
if (m/^\s*$/) {last};
m/(.*?)[:| ]\s*(.*?)[\r|\n]/;
$response->{$1} = $2;
}
close($s);
print Dumper($response);