my $child_pid = open my $child_fh, '-|', 'perl test.pl' or die "Can't run test.pl: $!"; my $first_line_of_output = <$child_fh>; close $child_fh;