This will output Total count : 5, because you only increment $total_count by one on each iteration. You probably want $total_count += $ret instead (or $total_count += $t->join, if you won't be using the return value for anything else, i.e.):
$total_count += $_->join for threads->list; print "Total count : $total_count \n"; __END__ Total count : 15
In reply to Re: Threads reinitializing the variable
by rjt
in thread Threads reinitializing the variable
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |