Do separate threads
- all see the same file-scoped lexicals
- each get their own file-scoped lexicals
#!/usr/local/bin/perl
use Threads;
my $a = 0;
my $t1 = Thread->new(\&inc_a);
my $t2 = Thread->new(\&inc_a);
$t1->join;
$t2->join;
print "$a";
sub inc_a
{
$a++;
}
What should the output be? 0? 1? 2?
- SWM
- Re: Threads and file-scoped lexicals Steven W McDougall
- Re: Threads and file-scoped lexicals Chaim Frenkel
