User Tools

Site Tools


handbook:handbook:perl2

Executing

There are several ways to execute a perl script. Let's assume that we have the script named test.pl. In any time, we can execute that script by calling the perl interpreter:

$perl test.pl

But, we may sometimes want to execute that script without the interpreter. To be able to execute it through our shell, we must first make sure that the scripts starts with the following line:

#!/usr/bin/perl

That, of course, tells where the perl interpreter is located. It may vary from system to system.

Next, we must be sure that the script has executable (+x) permissions. If it does not have, then we can make it executable:

chmod +x test.pl

And, at last, we can execute it:

./test.pl
handbook/handbook/perl2.txt · Last modified: 2010/04/15 21:18 (external edit)