in reply to thread::shared - shared but not shared?

Try it this way:

#! perl -slw use strict; use threads; use threads::shared; my %h :shared; $h{ 1 } = &share( {} ); $h{1}{2} = 3; { lock %{ $h{1} }; ## <<<< async { print "2:Waiting for lock"; lock %{ $h{1} }; print "2:lock acquired"; $h{1}{2} = 10; print '2:lock released'; }->detach; sleep 2; } print "1:Waiting for lock"; lock %{ $h{1} }; print $h{1}{2}; __END__ c:\test>junk70 2:Waiting for lock 1:Waiting for lock 2:lock acquired 2:lock released 10

It shouldn't be necessary, but it does work.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.