Perl Script Basics
This guide covers the essentials for running Perl scripts on hosting.com servers, including permissions, file extensions, and execution.
File Permissions for Perl Scripts
-
Web-accessible scripts: Set permissions to
755(read, write, execute for user; read and execute for group and others). -
Command-line only scripts: Set permissions to
700(read, write, execute for user; no permissions for group and others).
Note: If a script needs to write to a file (e.g., guestbooks or bulletin boards), the target file can have 644 permissions (read/write for user, read-only for group and others). |
File Extensions
-
.cgi – Use for Perl scripts that generate web output accessible to the public.
-
.pl – Use for scripts run only from the command line or that do not generate web output.
Perl Version
-
Hosting.com servers use Perl 5.16.
-
To check the version from the command line:
perl -v
Path to Perl Executable
-
Absolute path:
/usr/bin/perl -
/usr/binis in the default PATH, so you can usually run scripts like this:
perl filename
FTP Transfer Mode
-
Always use ASCII mode when uploading Perl scripts via FTP.
-
Uploading in binary mode can cause errors such as:
Internal Server Error: Premature End of Script Headers (500)
More Information
For official Perl documentation, visit Perl Docs.