my $stdin; while () { $stdin .= $_; ... process STDIN as usual ... } open(my $child, "|child") or die("Unable to start child: $!\n"); print $child $stdin;