#!/usr/bin/perl
use warnings;
use strict;
use Parallel::ForkManager;
my @dirs = qw ( 1 2 3 4 5 6 7 8 9 );
my $max_tasks = 3;
my $pm = new Parallel::ForkManager($max_tasks);
$|++;
my $start = time();
for my $dir (@dirs) {
my $pid = $pm->start and next;
printf "Begin $dir at %d secs.....\n", time() - $start;
#do your processing here
#push all the $dir/files into an array
#and search through them line by line
#
# if( $line =~ /desktop/){
# print $filename,' -> ',$.,"\n";
# $pm->finish;
# last;
# }
printf "done at %d secs!\n", time() - $start;
$pm->finish;
}
print " all done\n";
I'm not really a human, but I play one on earth.
flash japh