my $pipes = {}; for (qw/ ONE TWO THREE FOUR/) { pipe $pipes->{$_}{'FROM_CHILD'}, $pipes->{$_}{'TO_PARENT'}; #etc } #### my $listen = {}; foreach $kid (qw/ ACE DEUCE TREY OOPS/ ) { $listen->{$kid} = do { my ($from,$to,$pid); pipe $from, $to; # fork and all, child closes $from, # deletes $listen, does child code and exits. { handle => $from, pid => $pid } }; }