2

I want to run a perl script located in a PATH directory. Now command prompt does not search arguments in PATH directories. It just search files in current directory.

C:\Users\dg>echo %PATH%
...;C:\Users\dg\abc

C:\Users\dg>dir /a-d /b abc
abc.pl

C:\Users\dg>perl abc.pl
Can't open perl script "abc.pl": No such file or directory

Any solution or work around?

1

3 Answers 3

3

Just abc.pl should work for you if Perl is installed properly. Note, if you use perl abc.pl, bash won't search the path for abc.pl either: it will look in the current working directory and die if the file doesn't exist

If you want Perl to search the path for the script file then use the -S option

perl -S abc.pl
Sign up to request clarification or add additional context in comments.

Comments

0

Go with cd to your script directory. Run the folowing:
path_to_perl\perl.exe abc.pl

Comments

0

Looks like Windows. I have set the .pl extension to be opened by perl, using Control Panel\Programs\Default Programs\Set Associations. Then the command abc.pl works fine as long as it is on the path, as it is in your example.

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.