With regard to:
foreach my $host ( @servers ) { threads->new(\&process, $host )->join(); }
... creating a new thread and then immediately joining it is a waste of time; join waits for the thread to finish.
In this case, detach is probably better. Otherwise, keep an array of all threads and after you've created all of them, then join all of them.
Improve your skills with Modern Perl: the free book.
In reply to Re^5: Need help with Perl multi threading
by chromatic
in thread Need help with Perl multi threading
by ashok.g
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |