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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With