use strict; use LWP::Parallel::UserAgent; #Turns on debug mode _ outputs lot of info.. use LWP::Debug qw(+); $|++; my @sites = qw ( http://www.cnn.com http://www.sun.com http://www.msn.com http://www.sun.com http://www.bbc.co.uk ); my $totalbytes = 0; my $pua = LWP::Parallel::UserAgent->new(); #Build requests foreach (@sites) { my $req = HTTP::Request->new('GET',$_); $pua->register($req, \&Callback); } #Initiate request $pua->wait(); printf "\n\nTotalbytes read:%.2f KB", $totalbytes/1024; sub Callback { my ($data, $response, $protocol) = @_; $totalbytes += length $data; print "\nGot ",length $data," bytes of data from ", $response->base; }