use MCE::Loop chunk_size => 1, max_workers => 5; open my $fh, $domains or die "CRIT: Unable to open $domains: $!\n"; my %domainList = mce_loop_f { my $domainName = $_; chomp $domainName; my $expDate = `jwhois -n -h whois.crsnic.net $domainName | grep Expiration | awk '{print \$3}'`; my $diff = &dateDiff($expDate); if ($diff < 28 and $diff > 14) { $flag = 1; } elsif ($diff <= 14) { $flag = 2; } MCE->gather($domainName, $diff); } $fh; close $fh;