in reply to Retreiving variables from threads
Also if you declare them as shared, after you initialize them, you will lose the initialization.use threads; use threads::shared; my %shash; my @choices; my $x; share $shash{'go'}; share @choices; share $x; $shash{'go'} = 0; @choices = ( ); $x = 1;
Another tip is the main thread will not automatically read the shared variable (like thru a reference). You may need to actively read it in the main thread.
|
|---|