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
, but can't.