use strict; use warnings; use MCE::Shared; my $string = MCE::Shared->scalar("First value"); sub do_subroutine { print "I am the subroutine and my PID is $$\n"; $string->set("Second value"); } print "I am the invoking process and my PID is $$\n"; print "The value of \$string is ", $string->get(), "\n"; unless (fork) { do_subroutine (); exit; } my $waited_pid = wait; print "The PID of the child upon whom I waited was $waited_pid\n"; print "The value of \$string is ", $string->get(), "\n"; __END__ I am the invoking process and my PID is 22725 The value of $string is First value I am the subroutine and my PID is 22727 The PID of the child upon whom I waited was 22727 The value of $string is Second value