use strict; use LWP::Simple; use Parallel::ForkManager; # I assume you have reasons for a hash later..? my %urls = ( 'drudge' => 'http://www.drudgereport.com', 'rush' => 'http://www.rushlimbaugh.com/home/today.guest.html', 'yahoo' => 'http://www.yahoo.com', 'cds' => 'http://www.cdsllc.com/', ); my $pm = new Parallel::ForkManager(30); foreach my $file (sort keys %urls) { $pm->start and next; # do the fork # Start child code. my $ret = getstore($url{$file}, $file); print "File '$file' stored url '$url' with response code '$ret'\n"; # End child code. $pm->finish(); } $pm->wait_all_children;