Alex Rivera | Logout

Running Perl Script from Command Line?

Asked 2013-07-19T14:31:24.377
14

I have perl express 2.5 loaded on my server. I would like to be able to run my perl scripts using a command line so they can be scheduled rather than manually bringing up the script in Perl Express and clicking on the run command. Is there a way to execute the script from a command line using this version of Perl or do I need to download a newer or more robust version of the Perl Engine.

Edit
Report

1 Answer

17

You need to export the Perl interpreter (usually named perl) to your path. Then you can simply do

perl path/to/script.pl

In UNIX-based systems you are also able to run the scripts directly if you prepend

#!/usr/bin/perl

to the scripts and give them executable permissions (you might need to replace /usr/bin/perl with the path to your Perl interpreter).

answered 2013-07-19T14:37:06.713

Your Answer