I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2011-07-26 20:45:27.56605-07 by jdhedden in response to 13418
Re: Spawning multiple threads in a loop
I don't understand the logic of the 'if' in the 'foreach' loop. All you really need is:
foreach my $id (0..3) { # You don't need the 'my $thr =' construct here threads->create(\&output, $id, 30, $id, $fh); } foreach my $thr (threads->list()) { $thr->join(); }
The threads don't see the 'foreach' loop (i.e., this is not the same as using 'fork'). All they execute is what is inside the 'output' function.
Direct Responses: Write a response