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

Hello, hoping that someone can help me here. What i am doing is running the command
mac "foo.ape" -v
with perl by doing
@foobar=`mac \"foo.ape\" -v`;
i know that this would usually suppress the output of the called program and store the output into the variable @foobar, but this is not the case. it does in fact store the output, but it does not suppress it. so instead of a nice clean terminal when running my script i get
--- Monkey's Audio Console Front End (v 3.99) (c) Matthew T. Ashland - +-- Verifying... Progress: 7.1% (52.8 seconds remaining, 4.0 seconds total)
what i am trying to do is not have any of that output and just print a message like foo.ape file is ok or something similar. that is not the important part as i can accomplish that easily. what is important is that i just want that output to stop so that i can replace it. any help would be greatly appreaciated -Syco54645

Replies are listed 'Best First'.
Re: Running external command from perl but cannot capture output
by m.att (Pilgrim) on Apr 24, 2006 at 22:26 UTC
    Is it possible that it's outputting on STDERR as well as STDOUT? You can try redirecting STDERR somewhere else in the command such as:

    @foobar=`mac \"foo.ape\" -v 2>/dev/null`;

    Or, if you want to capture STDERR as well:

    @foobar=`mac \"foo.ape\" -v 2>&1`;

    m.att

      thanks for the reply. here is what i have right now
      @test=`mac \"$_\" -v >/dev/null 2>&1`;
      this suppresses the output, but does not put anything in @test. i am not too sure what to do.
        Leave out the >/dev/null part.