title: How can I use `pipe` to facilitate interprocess communication in Perl?
body: <p>Can anyone explain how I can successfully get my processes communicating? I find the perldoc on IPC confusing.</p>
  
  <p>What I have so far is:</p>
  
  <pre><code>$| = 1;
  $SIG{CHLD} = {wait};
  my $parentPid = $$;
  
  if ($pid = fork();) ) {
      if ($pid == 0) {
         pipe($parentPid, $$);
         open PARENT, "&lt;$parentPid";
         while (&lt;PARENT&gt;) {
             print $_;
         }
         close PARENT;
         exit();
      } else {
  
         pipe($parentPid, $pid);
         open CHILD, "&gt;$pid";
            or error("\nError opening: childPid\nRef: $!\n");
         open (FH, "&lt;list")
            or error("\nError opening: list\nRef: $!\n");
  
         while(&lt;FH&gt;) {
            print CHILD, $_;
         }
  
         close FH
            or error("\nError closing: list\nRef: $!\n");
         close CHILD
            or error("\nError closing: childPid\nRef: $!\n);
      } else {
      error("\nError forking\nRef: $!\n");
  }
  </code></pre>
  
  <ul>
  <li><p>First: What does <a href="https://perldoc.perl.org/functions/pipe.html" rel="nofollow noreferrer">perldoc pipe</a> mean by <code>READHANDLE</code>, <code>WRITEHANDLE</code>?</p></li>
  <li><p>Second: Can I implement a solution without relying on CPAN or other modules?</p></li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/hQYgc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hQYgc.jpg" alt="alt text"></a><br>
  <sub>(source: <a href="http://www.wellho.net/slideshow/plx8.jpg" rel="nofollow noreferrer">wellho.net</a>)</sub>  </p>