sub scan { $host = "$net.$hosts[$li]"; $socket = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $host, PeerPort => 80) or die $!; $socket->autoflush(1); print $socket "HEAD / HTTP/1.0\015\012\015\012"; while (<$socket>) { print; last if /^$/; } close($socket); }