in reply to Share hash across processes

That kind of sharing probably requires copying to a certain extent. You might end up using Storable to push it into a shared scalar, or Cache::Memcached to do some of the magic for you, but I don't think there's a magic way to share a nested structure without ... nesting on either end of the share. I could be mistaken, but I don't think you can.

If you choose something like DB_File or DBM::Deep, you'll probably find the use of the local filesystem (if available) to be pretty darned efficient. IIRC, DB_File even handles buffering for you (the berkely db magic).

It is possible to write your own hash class with tie. You could make each key a shared scalar (using whatever method you like). Perhaps that's the best way if you have something really specific in mind, because then you can explicitly state what you want and perl will do it. :)

My thinking is that you might be accustomed to sharing huge segments of memory in C/C++. I'm not sure there's anything directly comparable in perl — though I wouldn't be surprised if there were. As a last resort, you could write something in XS or Inline::C. That sounds pretty interesting to me.

-Paul