Perl script basics
This guide covers the essentials for running Perl scripts on Ruachost servers, including permissions, file extensions, and execution.
File Permissions for Perl Scripts
Section titled “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).
File Extensions
Section titled “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
Section titled “Perl Version”- To check the Perl version on your server, run
perl -vover SSH. - To check the version from the command line:
perl -vPath to Perl Executable
Section titled “Path to Perl Executable”- Absolute path:
/usr/bin/perl /usr/binis in the default PATH, so you can usually run scripts like this:
perl filenameFTP Transfer Mode
Section titled “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
Section titled “More Information”For official Perl documentation, visit Perl Docs.