#! perl -slw use threads; use threads::shared; use LWP::UserAgent; use HTTP::Request; my $semStdout :shared; my $running :shared = 0; open(LIST,"urls.txt"); while ( my $tld = ) { chomp $tld; Win32::Sleep( 100 ) while do{ lock $running; $running >= 10 }; async{ { lock $running; ++$running; } my $url = "http://$tld/"; my $ua = new LWP::UserAgent; $ua->timeout(5); $ua->agent("Mozilla/6.0"); my $req = HTTP::Request->new('GET',$url); my $res = $ua->request($req); my $content = $res->content; my $status = $content =~ /OK/i ? 'ack' : 'nak'; { lock $semStdout; printf "(%3d)$tld: %s\n", threads->self->tid, $status; } { lock $running; --$running; } }->detach; } close(LIST);