Assuming that Perl is correctly installed and working on your system, the simplest way to run a Perl program is to type the following: perl filename.pl
The filename should be replaced by the name of the program that you are trying to run or execute. If you created a test.pl file while reading the previous section, you can run it like this: perl test.pl
This example assumes that perl is in the execution path; if not, you will need to supply the full path to perl, too. For example, on UNIX the command might be: /usr/local/bin/perl test.pl
Whereas on Windows NT, you might need to use:
c:\
perl5\
bin\
perl test.pl
UNIX systems have another way to invoke a program. However, you need to do two things. The first is to place a line like
#!/usr/local/bin/perl
at the start of the Perl file. This tells UNIX that the rest of this script file is to be run by /usr/local/bin/perl. The second step is to make the program file itself executable by changing its mode:
chmod +x test.pl
Now you can execute the program file directly and let the program file tell the operating system what interpreter to use while running it. The new command line is simply: test