my $pid = open my $ph, "thing.sh args |" or die $!; while ( <$ph> ) { # process output from thing.sh } close $ph; waitpid $pid, 0;