use strict; use warnings; use IPC::Shareable; my $scalar; my $foo = tie $scalar, 'IPC::Shareable', 'k123', { create => 1, destroy => 1 }; my $pid = fork(); if(! defined $pid) { die "fork err"; } elsif($pid == 0) { # Child undef $foo; untie $scalar; print "Child ends\n"; exit 0; } else { # Parent sleep(1); undef $foo; untie $scalar; print "Parent ends\n"; }