in reply to Output of a command

"ebs --version" probably writes output to stderr, not stdout. Also, you should be saying $command = 'ls';; if you left quotes off for the ebs command, that would cause you trouble.

Replies are listed 'Best First'.
Re^2: Output of a command
by Niel (Initiate) on Jul 30, 2008 at 05:33 UTC
    YES you are right. Thanks on this!!!!! The output is going to STDERR.
    Now my question is, should it go to STDERR when its not an error? this is just get the information of the product!!!!
        It's a pet peeve of mine for help text explicitly requested to go to stderr. If I asked for it, and it's long, please put it on stdout so I don't have to work harder to pipe it into $PAGER. Of course, if something's wrong and you need to give me an error message with some helpful text, it's fine to put it on stderr to lessen the chance of breaking my pipes.
      You could be using IPC::Open3 , it will get output from STDOUT,STDERR .
      Some examples (*nix) if you only need one stream of the commands output:
      $command = "curl -D- http://www.perlmonks.org"; # mixes stderr and st +dout # stdout only, no stderr noise $stdout_only = `$command 2>/dev/null`; # stderr only, no stdout noise $stderr_only = `$command 2>&1 1>/dev/null`; # both mixed up (usually not a good idea!) # Aliens suggestion to use open3 is better in this case. $brundlefly = `$command 2>&1`;