title: How to discard STDERR from an external command in Perl?
body: <p>I want to capture exit code of an external command while replacing its standard error output with a custom error message.</p>
  
  <pre><code>my $ret = system("which mysql");
  if ($ret != 0) {
      say "Error";
  }
  </code></pre>
  
  <p>If <code>mysql</code> executable is not there, it shows <code>which</code> command error message, which I don’t want. How to get rid of it?</p>