FAQ 7.29 What does "bad interpreter" mean?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.


7.29: 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

            % 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.


Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.


    Copyright (c) 1997-2002 Tom Christiansen and Nathan
    Torkington, and other contributors as noted. All rights

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.

Site Timeline