Thread shared variables will have to be declared.
Perhaps
my $foo :shared;
Otherwise, the variable refers to thread specific storage.
Up for grabs is what the variable contains upon thread start. undef
or a copy-on-write version of the original.
> "SWM" == Steven W McDougall <[EM
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 outp