Vary -N=nn to suit your bandwidth:
#! perl -slw use strict; use threads; use Thread::Queue; use LWP::Simple; our $N ||= 10; my $Q = new Thread::Queue; my @pool = map async{ print "$_ :", head( $_ ) ? 'ok' : 'not ok' while $_ = $Q->dequeue; }, 1 .. $N; while( <> ) { chomp; $Q->enqueue( $_ ); } $Q->enqueue( (undef) x $N ); $_->join for @pool; __END__ C:\test>headUrls.pl -N=20 urls.txt http://www.shops-gifts.shopiwon.com/ :not ok http://1ezbiz.leadsomatic.com :ok http://Indserve.com/kids :not ok http://16066.profitmatic.com :ok http://1-family.com/office/web/tp514/Boats.shtml :ok http://1mboard.proboards28.com/index.cgi :ok http://1plus-longdistance.com/domain/ :ok http://1stopsquare.com/101xyron.html :ok http://1world.leadsomatic.com :ok http://1stphoenix.veretekk.com/index.html :ok http://1stphoenix.veretekk.com :ok http://1bernard.veremail.com/index.html :ok
In reply to Re: Question: Fast way to validate 600K websites
by BrowserUk
in thread Question: Fast way to validate 600K websites
by lihao
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |