title: IPC communication between 2 processes with Perl
body: <p>Let's say we have a 'Child' and 'Parent' process defined and subroutines</p>
  
  <pre><code>my $pid = fork;
  die "fork failed: $!" unless defined($pid);
  
  local $SIG{USR1} = sub {
  kill KILL =&gt; $pid;
  $SIG{USR1} = 'IGNORE';
  kill USR1 =&gt; $$;
  };
  </code></pre>
  
  <p>and we divide them, is it possible to do the following?</p>
  
  <pre><code>if($pid == 0){
      sub1();
  #switch to Parent process to execute sub4()
      sub2();
  #switch to Parent process to execute sub5()
      sub3();
  }
  else
  {
      sub4();
  #send message to child process so it executes sub2
      sub5();
  #send message to child process so it executes sub3
  }  
  </code></pre>
  
  <p>If yes, can you point how, or where can I look for the solution? Maybe a short example would suffice. :)</p>
  
  <p>Thank you.</p>