Yes, you can share individual elements of a hash (using share()):
use strict; use warnings; use threads; use threads::shared; my %h; share $h{ fred }; $h{fred} = 2; async{ my $a='bill'; lock $h{fred}; $h{fred}=$a; }->join; print $h{fred}; bill
In reply to Re^3: threads with shared variables across multiple instances of a module
by BrowserUk
in thread threads with shared variables across multiple instances of a module
by fert
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |