Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Im looking for a threading (Threads) and/or (Thread:queue) Equivalent to my script that Basically this just runs through a list with different threads each thread doing a different variable from the array Example Below
use Parallel::ForkManager; my $max_processes = '10'; my $pm = Parallel::ForkManager->new($max_processes); my $array = 'list.txt'; open my $handle, '<', $array; chomp(my @array = <$handle>); close $handle; for my $printme (@array) { my $pid = $pm->start and next; print $printme; $pm->finish; } $pm->wait_all_children;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Threading Equivalent to this Parallel::ForkManager Example
by BrowserUk (Patriarch) on Apr 02, 2014 at 07:27 UTC | |
|
Re: Threading Equivalent to this Parallel::ForkManager Example
by kcott (Archbishop) on Apr 02, 2014 at 07:49 UTC | |
by BrowserUk (Patriarch) on Apr 02, 2014 at 08:00 UTC | |
by kcott (Archbishop) on Apr 02, 2014 at 08:13 UTC | |
|
Re: Threading Equivalent to this Parallel::ForkManager Example
by zentara (Cardinal) on Apr 02, 2014 at 16:20 UTC |