#!/usr/local/bin/perl use strict; my ($page,$total) = ('http://www.sics.se/~joe/bluetail/vol1/v1_oo.html',0); use threads; for (my $i=0;$i<10;$i++) { threads->create({'stack_size' => 32*4096},\&sub1, $page, $i); } while ($total < 10) { foreach my $thread_join (threads->list(threads::joinable)) { $total++; my $res = $thread_join->join(); print "Thread done\n"; } } print "Press ENTER to finish"; my $ok = ; sub sub1() { my ($url,$i, $content) = @_; require LWP::UserAgent; my $ua = LWP::UserAgent->new; my $response = $ua->get($url); print "\t[$i]FETCHED $url\n"; if ($response->is_success) { $content = $response->decoded_content; } return; }