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.
<chaim>
>>>>> "SWM" == Steven W McDougall <[EMAIL PROTECTED]> writes:
SWM> Do separate threads
SWM> - all see the same file-scoped lexicals
SWM> - each get their own file-scoped lexicals
SWM> #!/usr/local/bin/perl
SWM> use Threads;
SWM> my $a = 0;
SWM> my $t1 = Thread->new(\&inc_a);
SWM> my $t2 = Thread->new(\&inc_a);
SWM> $t1->join;
SWM> $t2->join;
SWM> print "$a";
SWM> sub inc_a
SWM> {
SWM> $a++;
SWM> }
SWM> What should the output be? 0? 1? 2?
SWM> - SWM
--
Chaim Frenkel Nonlinear Knowledge, Inc.
[EMAIL PROTECTED] +1-718-236-0183