rnbcoder rnbcoder - 1 year ago 92
Perl Question

run perl scripts from PATH folder in command prompt

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>dir /a-d /b abc

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

Any solution or work around?

Answer Source

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download