It turns out the problem has to do with the restriction that you should share scalar variables, not complex structures like hashes. So the parent can see the child's hash modifications if you do something like this:
use forks; use forks::shared; my %GLOBALHASH : shared; my %hashref : shared; $hashref = \%GLOBALHASH; $child = fork (); if (!$child) { # child $hashref->{OILPRICE} = 100; exit 0; } elsif ($child) { # daddy sleep (2); print "Global Oils Price is now: " . $hashref->{OILPRICE} . " doll +ars\n"; }
However, I've not been able to get this to work with hashes of hashes.
In reply to Re^2: forked::shared with hashes?
by GriffinP
in thread forked::shared with hashes?
by GriffinP
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |