use threads('yield','stack_size' => 64*4096, 'exit' => 'threads_only', 'stringify');
use Thread::Queue;
use various others(File::..., DBI....
my @FoundFiles = subroutine to get all of the applicable files(and their directories).
my $Threads = 8;
my $workq = Thread::Queue->new();
$workq->enqueue(@FoundFiles);
$workq->enqueue(undef) for (1..$Threads);
threads->create('executeall') for (1..$Threads);
sub executeall
{
while(my $i = $workq->dequeue())
{
last if $i eq undef;
if($i =~ /filetypea/)
{
parseitthisway($i);
}
if($i =~ /filetypeb/)
{
parseitanotherway($i);
}
....
....
}
threads->detach();
}
####
push(@array, $data);
####
++{%newHotness{$data};
####
while(my ($k, $v) = each(%newHotness))
{
...check that I have the expected $v per $k
}
####
@array = ();
undef @array;
####
@array = ();
undef @array;