in reply to Multitasking in Perl
i.e. fire all the instances at the same time?
So long as you realise that unless you have 'n' processors, your 'n' instances will not al be running "at the same time".
And, just so the "other option" doesn't go unmentioned. If you were thinking "put it in a subroutine and call it that many number of times" looked vaguely like this:
sub doit { .... } doit( $args[ $_ ] ) for 0 .. $n-1;
Then
use threads; sub doit { ... } my @threads = map{ threads->new( \&doit, $args[ $_ ] ) } 0 .. $n - 1; $_->join for @threads;
is about a simple as multi-tasking gets.
|
|---|