foreach my $i (0..$#tmp) { # Forks and returns the pid for the child: my $pid = $pm->start($i); if ($pid) { print "Pid of Child process $pid\n"; next; }; } #### my $filename = $tmp[$i]->filename(); my $file = IO::File->new("<$filename") or die "Can't open $filename\n"; while((my $line) = $file->getline()) { last unless defined($line); chomp $line; my ($dir, $file) = split(/\t/, $line); #### $process->($dir, $file, $config, $log); } $pm->finish; # Terminates the child process