Does that work bidirectionally?Yes, it does.
UPDATE: Sample code:
Output:use warnings; use strict; use forks; use forks::shared; my %GLOBALHASH : shared; share (%GLOBALHASH); my $pid = fork (); if (!$pid) { # child $GLOBALHASH{OILPRICE} = 100; sleep 1; print "Gold price from the parent: $GLOBALHASH{GOLDPRICE}\n"; exit 0; } elsif ($pid) { # daddy $GLOBALHASH{GOLDPRICE} = 200; sleep 2; print "Global Oils Price is now: " . $GLOBALHASH{OILPRICE} . " dol +lars\n"; }
Gold price from the parent: 200 Global Oils Price is now: 100 dollars
In reply to Re^7: forked::shared with hashes?
by choroba
in thread forked::shared with hashes?
by GriffinP
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |