3

I got a perl script named test_perl.pl and try to exec it.
The first line of the scrpit is:

#!/usr/bin/perl

When I try to exec this script, I get an error.

$ type perl
perl is /usr/bin/perl

$ ll /usr/bin/perl test_perl.pl
-rwxr-xr-x 2 root        root        10352 2011-04-23 03:32 /usr/bin/perl*
-rwxr-xr-x 1 jim         jim         12121 2013-11-21 11:47 test_perl.pl*


$ test_perl.pl
test_perl.pl: line 1: #!/usr/bin/perl: No such file or directory

I don't no why this happens.

1 Answer 1

4

You have a BOM (see http://en.wikipedia.org/wiki/Byte_order_mark) at the beginning of your file.

try

 xxd test_perl.pl

to see it. Getting rid of the BOM will fix your script: Lots of ways to do this: Using awk to remove the Byte-order mark

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.