Sounds to me like you probably want the Net::HTTP::NB
module (a non-blocking HTTP client), and especially its read_response_headers
method. See the module for example and description, but in a nutshell you can do this:
my $s = Net::HTTP::NB->new( Host => 'www.perlmonks.org' );
$s->write_request( GET => "/" );
my( $code, $msg, %headers ) = $s->read_response_headers;
(However, don't actually do it like that. See the module for a better example.)
The 6th Rule of Perl Club is -- There is no Rule #6.