use strict; use warnings; use LWP::UserAgent; use threads; my @websites = ( 'http://mysite.com/page', 'http://myothersite.com/page', 'http://myotherothersite.com/page', 'http://myotherotherothersite.com/page', ); my @threads; for my $url (@websites) { push @threads, threads->create(\&fetch, $url); } my @pages; for my $thread (@threads) { push @pages, $thread->join; } sub fetch { my $url = shift; my $ua = LWP::UserAgent->new; my $result = $ua->get($url); return $result->is_success ? $result->decoded_content : "Page retrieval failed"; } #### my @pages = map $_->join, map threads->create(\&fetch, $_), @websites;