Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'd like to capture some output from my command-line program and use it to determine the next action in my perl script. How do I go about it? Thanks

Replies are listed 'Best First'.
Re: capturing program output
by merlyn (Sage) on Aug 24, 2000 at 23:34 UTC
Re: capturing program output
by BlaisePascal (Monk) on Aug 24, 2000 at 23:33 UTC
    open $FH, "myprogram here |";
    I think that'll do what you want. The output of myprogram should be available on the $FH filehandle.

    If I'm wrong, other's will correct me soon enough...

        You are right, but I think it's really a matter of style...

        won't open $file,"myprogram here |" or die ... work as well, placing the filehandle reference in $file?

        Thanks for catching the lack of error-checking...