From: PerlFAQ Server on
This is an excerpt from the latest version perlfaq7.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .

--------------------------------------------------------------------

7.30: What does "bad interpreter" mean?

(contributed by brian d foy)

The "bad interpreter" message comes from the shell, not perl. The actual
message may vary depending on your platform, shell, and locale settings.

If you see "bad interpreter - no such file or directory", the first line
in your perl script (the "shebang" line) does not contain the right path
to perl (or any other program capable of running scripts). Sometimes
this happens when you move the script from one machine to another and
each machine has a different path to perl--/usr/bin/perl versus
/usr/local/bin/perl for instance. It may also indicate that the source
machine has CRLF line terminators and the destination machine has LF
only: the shell tries to find /usr/bin/perl<CR>, but can't.

If you see "bad interpreter: Permission denied", you need to make your
script executable.

In either case, you should still be able to run the scripts with perl
explicitly:

% perl script.pl

If you get a message like "perl: command not found", perl is not in your
PATH, which might also mean that the location of perl is not where you
expect it so you need to adjust your shebang line.



--------------------------------------------------------------------

The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
are not necessarily experts in every domain where Perl might show up,
so please include as much information as possible and relevant in any
corrections. The perlfaq-workers also don't have access to every
operating system or platform, so please include relevant details for
corrections to examples that do not work on particular platforms.
Working code is greatly appreciated.

If you'd like to help maintain the perlfaq, see the details in
perlfaq.pod.