The two above give good suggestions. Your problem at the moment, I think, is that you are only sharing that variable - any deep structure is not shared. See this from threads::shared:
"share" will traverse up references exactly one level.
"share(\$a)" is equivalent to "share($a)", while "share(\\$
not. This means that you must create nested shared data st
by first creating individual shared leaf notes, then adding
+ them to
a shared hash or array.
I haven't tried it, but as BrowserUK points out the newer versions of threads::shared claim to do what you want.