#!/usr/bin/perl -w use strict; my %kids = (); my @msgs = (); $SIG{CHLD} = q/IGNORE/; for ( 'a', 'b', 3) { my ( $pid, $fh); defined($pid = open $fh, "-|") or warn $! and last; if ($pid) { # be parental $kids{$pid} = $fh; next; } else { kid_code($_); } } push @msgs, <$_> for values %kids; print @msgs; sub kid_code { # do childish things, then (goes to $fh in parent) print "$_[0]. Your Message Here$/"; exit(0); }