$href->{a} = &share({}); $href->{a} = {}; #### #!/usr/bin/perl use warnings; use strict; use threads; use threads::shared; use Data::Dumper; my $href = &share({}); #$href = {}; sub sub1 { sleep 1; print threads->tid(); print Dumper $href; } $href->{a} = &share({}); #$href->{a} = {}; my $th1 = threads->new('sub1'); $href->{b} = &share({}); my $th2 = threads->new('sub1'); $th1->join(); $th2->join(); __OUTPUTS_ C:\test>junk1 1$VAR1 = { 'a' => {}, 'b' => {} }; 2$VAR1 = { 'a' => {}, 'b' => {} }; #### #!/usr/bin/perl use warnings; use strict; use threads; use threads::shared; use Data::Dumper; my %hash :shared; sub sub1 { sleep 1; print threads->tid(); print Dumper \%hash; } $hash{a} = &share({}); my $th1 = threads->new('sub1'); $hash{b} = &share({}); my $th2 = threads->new('sub1'); $th1->join(); $th2->join(); __OUTPUTS__ C:\test>junk1 1$VAR1 = { 'a' => {}, 'b' => {} }; 2$VAR1 = { 'a' => {}, 'b' => {} };