in reply to mysterious threads::shared behaviour
Update: spoke too soon, sorry -- I'd left out the use threads.
With use threads in I get the same as you. I notice the caveat in cpan:/threads::shared re refaddr() -- I guess that applies to stringification too. So, it seems to be a documented problem. is_shared() is recommended in place of refaddr, but I don't know how that helps you with XML::Dumper -- sorry.
FWIW: I just tried your code and got 11 different addresses -- I have perl 5.10.0 with threads::shared version 1.14 (32 bit Win32) and 1.27 (64 bit Linux).
In the past I have found shared() to be less than useful. You could try:
and see if it works any better for you.for (0..10) { my %sh : shared ; $h{$_}=\%sh ; }
In Section
Seekers of Perl Wisdom