title: Fork multiple children in Perl and use pipes for bi-directional communication
body: <p>I am trying to create a small Perl program which has multi processing capabilities. Since there are some small changes here and there in my requirements, I am not able to find any similar sample scripts anywhere.</p>
  
  <p>I need to read a big logfile from STDIN and give first N number (a big number again) of lines to the first child process and then next N number of lines to the second child process etc. I have also a constant defined which is the maximum number of child processes allowed to run concurrently. Once maximum number of children reached, parent will wait for a child to finish its job and give another N number of lines to it.</p>
  
  <p>The parent process also collects a multi-line (5-10 lines) output returned by each child process when they finish and stores it in an array. Parent then continues to process this array contents and display the results finally.</p>
  
  <p>Is there a better sample script which I can modify and use or could someone help me by sharing one here? I prefer using only pipes for process intercommunication and keep things simpler as much as possible.</p>
  
  <p>Edit:
  Can someone show an example how this can be accomplished only using pipes from IO::Handle module ?</p>