in reply to share() bug? ( [perl #30702] )

Agreed! Here are two other cases, and the second one is quite interesting:

Share the reference of an array, cause the same problem:

use threads; use threads::shared; use Data::Dumper; use warnings; use strict; my $a = [1,2]; print Dumper($a); share($a); print Dumper($a);

This printed:

$VAR1 = [ 1, 2 ]; $VAR1 = [];

More interestingly ;-) share an element of an array, does not lose the content, but alter the content:

use threads; use threads::shared; use Data::Dumper; use warnings; use strict; my $a = [1,2]; print Dumper($a); share($a->[0]); print Dumper($a);

This gives you:

$VAR1 = [ 1, 2 ]; $VAR1 = [ '1',#look at this 2 ];