use strict; use IO::Socket; $|++; my( $host, $port, $kidpid, $handle, $line ); ( $host, $port ) = @ARGV; my $msg = qq{HEAD / HTTP/1.0\nHOST: $host\n\n}; $handle = IO::Socket::INET->new( Proto => 'tcp', PeerAddr => $host, PeerPort => $port, Blocking => 0) or die("$!"); $handle->autoflush(1); $handle->send( $msg, undef, "test" ); my @results; for( 0..10 ) { last if @results = $handle->getlines; select(undef, undef, undef, .5); } print @results; exit;