title: How to capture both STDOUT and STDERR in two different variables using Backticks in Perl
body: <p>Let's say I want to run an external program from my script with backticks and at the same time I want to capture both STDOUT and STDERR but in two different variables. How can I do that? For istance if I run this script...</p>
  
  <pre><code>my $cmd = `snmpwalk -v $version -c $community $hostname $oid`;
  </code></pre>
  
  <p>...if there is no error everything works just fine BUT if the command raise an error this error will be printed on the command line and I don't want that to happen. I want to capture the error as well. Nothing has to be printed on the screen. Any ideas?</p>