Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Appreciate your help. TIA.my ($thr, $total_count); sub create_file { my $count = shift; open(FH, ">$count"); close(FH); return $count; } foreach my $count (1 .. 5) { $thr = threads->create(\&create_file, $count); } foreach my $t (threads->list()) { $ret = $t->join; $total_count += 1; } print "Total count : $total_count \n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Threads reinitializing the variable
by choroba (Cardinal) on Aug 05, 2013 at 14:20 UTC | |
|
Re: Threads reinitializing the variable
by Loops (Curate) on Aug 05, 2013 at 14:22 UTC | |
|
Re: Threads reinitializing the variable
by rjt (Curate) on Aug 05, 2013 at 14:24 UTC |