title: Why doesn't this fork loop work as expected?
body: <p>Why does the following code:   </p>
  
  <pre><code>#!/usr/bin/perl
  use strict;
  use warnings;
  use Parallel::ForkManager;  
  
  my $pm = new Parallel::ForkManager(5);
  
  my @all_data = ('a','b','c','d','e','f');
  
  foreach my $data (@all_data) {
      # Forks and returns the pid for the child:
      my $pid = $pm-&gt;start and next; 
      print "Hello $pid\n";
      $pm-&gt;finish; # Terminates the child process
  }
  $pm-&gt;wait_all_children;  
  </code></pre>
  
  <p>print:  </p>
  
  <pre><code>Hello 0  
  Hello 0  
  Hello 0  
  Hello 0  
  Hello 0  
  </code></pre>
  
  <p>I am new to Perl and I am trying to catch up on multiprocessing in Perl</p>