Threads and file-scoped lexicals

[email protected] (Steven W McDougall) Fri, 25 Aug 2000 23:37:34 -0400 (EDT)
Newsgroups perl.perl6.language.flow
Message-ID <[email protected]>
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