How to Insert a Perl Script on your Website

Two methods exist to use a Perl script on your website:

1) Direct Method
This method implies the direct use of the Perl file, meaning that it is called without being included in another file. To do so, simply place the file in your public_html folder or one of its subfolders. Note that this file should have access rights 755 (read and execute rights for everyone, write rights for the owner) to work as expected. Moreover, the first line in the file should be "/usr/bin/perl".

To access the file, use the access path of the ".pl" file. For example, if "script.pl" is in your "public_html" folder, visit "mydomain.com/script.pl".

2) Indirect Methode
This method implies the indirect use of the Perl file, meaning that it is included in an ".shtml" file. To do so, you first need to create a ".shtml" file. In it, insert the following command: "" where "script.pl" is the name of the Perl script. In the current example, the ".pl" script must be in the same folder as the ".shtml" file.

Note that this file should have access rights 755 (read and execute rights for everyone, write rights for the owner) to work as expected, otherwise the ".shtml" file will display a blank page. Moreover, the first line in the file should be "/usr/bin/perl".

To access the file, use the access path of the ".shtml" file. For example, if "script.pl" and "page.shtml" are in the "public_html" folder, visit "mydomain.com/page.shtml", which will display the results of the "script.pl" file.

 

Article ID: #HC5024

Was this answer helpful?