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:
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:
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: