in reply to Threads reinitializing the variable
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
|
|---|