title: Why does "which" miss commands even when the /bin directory is in PATH?
body: <h1>Background</h1>
  
  <p>I am currently testing a perl script, running in cshell (<a href="http://www.grymoire.com/unix/CshTop10.txt" rel="nofollow noreferrer">company default if you were wondering</a>) that will be used by a Jenkins job. As part of that script, I am doing a sanity check that gradle exists in the path.</p>
  
  <p>I am adding the gradle directory to the path, then I save a local version of the path as seen below:</p>
  
  <pre><code>$ENV{PATH} .= ":/vobs/common/gradle-X.X/bin";
  my $myPATH = $ENV{ "PATH" };
  </code></pre>
  
  <p>Then I do the sanity check with the <a href="https://linux.die.net/man/1/which" rel="nofollow noreferrer">which</a> command inside a <a href="https://perldoc.perl.org/functions/system.html" rel="nofollow noreferrer">system</a> command as depicted below:</p>
  
  <pre><code>system ("/bin/env PATH=$myPath which gradle" );
  </code></pre>
  
  <p>The error returned states that I added the path correctly, but for some reason it cannot find gradle within it as seen below:</p>
  
  <pre><code>which: no gradle in (&lt;standard directories&gt;:/vobs/common/gradle-X.X/bin)
  </code></pre>
  
  <hr>
  
  <p><strong>Note:</strong> Another main reason I mentioned cshell is that these two questions <strong>don't</strong> apply to my issue because they are bash related: </p>
  
  <p><a href="http://www.grymoire.com/unix/CshTop10.txt" rel="nofollow noreferrer">Why 'whereis' and 'which' don't show me location of command?</a></p>
  
  <p><a href="https://unix.stackexchange.com/questions/5609/how-do-i-clear-bashs-cache-of-paths-to-executables">How do I clear Bash's cache of paths to executables?</a></p>
  
  <h1>Question</h1>
  
  <p>Why does "which" miss commands despite knowing that the /bin directory exists in the path?</p>