Perl -The characteristics of the language

July 2017

The source file and interpretation

The source file of a program written in Perl is a simple text file with the .pl extension.
This source file must be a non-formatted text file, that is to say a text file in its simplest form, without any special formatting (bold, underline..etc) or special characters, only basic ASCII ones. When the program is ready to be "tested", it can be directly be executed by the interpreter.


Perl is case sensitive, meaning by that a name containing uppercase is considered as being different from the same name written in lowercase. Thus, the specifications of the Perl language indicates that function for the standard output stream must be called print() and Print() or PRINT().

On the other hand, every statement ends with a semicolon.

Adding comments

When a program is long and complicated it may be interesting (recommended) to add comment in the program, that is to say, lines of text that aim to explain how the programs work. These lines will not be taken into account by the interpreter.

The # character allows you to define your comments. Example:
#This is a comment!

Example of a Perl script

Here is the simplest example of a Perl script, the traditional Hello World:

print("Hello World!");  

The first line specifies the location of the Perl interpreter on the system. In the example above it is a Unix system, under Windows, the script may look like that:

print("Hello World!");

The second line sends the "Hello World" string to the standard output stream
To write a CGI script, a script whose standard output is to be sent to a web browser, an additional line is needed:
print("content-type : text/html\n\n");  

print("Hello World!");

Orignal document published on


Published by jak58. Latest update on April 4, 2013 at 10:15 AM by deri58.
This document, titled "Perl -The characteristics of the language," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (