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

Hi everyone,
    I was wondering if there is a way to capture the output of another file and read it into you're script. I'm not talking about piping it in at the command line but have the perl script run a program and capture the output. Any help you can give would be welcomed, be it a function or a complicated trick. Thanks in advance.

-Ben Jacobs
Just Another Perl Newbie

  • Comment on Capturing the output of another program

Replies are listed 'Best First'.
Re: Capturing the output of another program
by Chmrr (Vicar) on Apr 28, 2001 at 05:13 UTC

    This is a fairly commonly asked question. In the future, please search the monastery before posting. Typing "capture program output" into the search box came up with multiple answers right off the top.

    Anyways, here is one node about it. PerlFAQ also has an answer to this one, here.

     
    perl -e 'print "I love $^X$\"$]!$/"#$&V"+@( NO CARRIER'