Multithreading
This is really cool tool
- Install the Library Parallel::ForkManager through CPAN
- It works only in a loop (of anykind). so make a loop if you don't have one
- code as below
# Libraries
use Parallel::ForkManager;
# My Variables
my $pm = new Parallel::ForkManager(4); # 4 is the number of cores in your processor
# Loop
foreach my $file(@files) {
$i++;
$pm->start and next;
# Do your bog process
$pm->finish;
}
$pm->wait_all_children;
# END