title: /usr/bin/env perl does work as command but not in perl script
body: <p>I've got a perl script which contains the first line as follows:</p>
  
  <pre><code>#!/usr/bin/env perl
  </code></pre>
  
  <p>I already read that this is executed to find perl in the environment. But now, when I execute this on the command line <code>/usr/bin/env perl</code>, perl itself gets executed (which is located at <code>/usr/bin/perl</code>). But when I start the script using <code>./myscript.pl</code>, it shows the following error:</p>
  
  <pre><code>/usr/bin/env: No such file or directory
  </code></pre>
  
  <p>This results out of the fact that it can't find <code>perl</code>, because this error also appears when I type <code>/usr/bin/env xxxxxx</code>.</p>
  
  <p>Can somebody explain me what exactly is the difference when I run it on command line or in a script?</p>