CJ7
CJ7

Reputation: 23275

How to make Perl script executable?

I have given a perl script file executable permission on a Unix based system, but when I try to execute the file I get a "command not found" error. I have #!usr/local/bin/perl at the start of the script file.

Upvotes: 0

Views: 4438

Answers (2)

Pavan
Pavan

Reputation: 41

replace your first line #!usr/local/bin/perl with #!usr/bin/perl(which is called Shebang). Then you can run the file with perl <Path To File>.

Upvotes: 0

Loukan ElKadi
Loukan ElKadi

Reputation: 2877

At the top of your script, replace the #!usr/local/bin/perl with #!/usr/bin/perl notice the root '/' prior to the usr/

And you can try perl <filename> keyword to run the file instead of ./<filename>, using perl keyword should run the script regardless of the shebang line at the top of your script.

Upvotes: 2

Related Questions