title: Simple open3 example not working
body: <p>I am trying to make a Master perl script calling children perl script and interacting through a pipe.</p>
  
  <p>I have write this code for the master :</p>
  
  <pre><code>#!/usr/bin/env perl
  
  use strict;
  use warnings;
  
  use IPC::Open3;
  
  my @children;
  
  for my $i ( 0 .. 4 ) {
      print "Master: " . $i . ", I summon you\n";
  
      $children[$i] = {};
  
      $children[$i]-&gt;{'pid'} = open3( my $CH_IN, my $CH_OUT, my $CH_ERR, 'perl child.pl -i ' . $i );
  
      $children[$i]-&gt;{'_STDIN'}  = $CH_IN;
      $children[$i]-&gt;{'_STDOUT'} = $CH_OUT;
      $children[$i]-&gt;{'_STDERR'} = $CH_ERR;
  
      my $line = readline $children[$i]-&gt;{'_STDOUT'};
      print $line ;
  
  }
  
  print "Master: Go fetch me the sacred crown\n";
  
  for my $i ( 0 .. 4 ) {
      $children[$i]-&gt;{'_STDIN'}-&gt;write("fetch the sacred crown\n");
      my $line = readline $children[$i]-&gt;{'_STDIN'};
      print $line ;
  }
  
  print "Master: Thanks. Now die!!!\n";
  
  for my $i ( 0 .. 4 ) {
      $children[$i]-&gt;{'_STDIN'}-&gt;write("die !!\n");
      my $line = readline $children[$i]-&gt;{'_STDIN'};
      print $line ;
  }
  </code></pre>
  
  <p>And this one for the child :</p>
  
  <pre><code>#!/usr/bin/env perl
  
  use Getopt::Long ;
  
  my $cmdline_id ;
  
  GetOptions ('i=s' =&gt; \$cmdline_id) ;
  
  my $id = $cmdline_id ;
  
  exit 1 if !defined $id ;
  
  print "I am $id, and I am awaken\n" ;
  
  while(&lt;STDIN&gt;) {
      print STDOUT $id . ': Master ask me to ' . $_ ;
  
      if ($_ =~ /exit/oi) {
          exit 0 ;
      }
  }
  </code></pre>
  
  <p>But when I launch the Master he just hung while reading the response from the child.</p>
  
  <p>Any idea about what I did wrong, and why ?</p>