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