When you learn every computer programming language you may realize that the first program to demonstrate is “Hello World”. Therefore, we use this simple but famous program to write the first program in Perl.
First, you open the Open Perl IDE and type the following code:
You can save the Perl source code file with any name and extensions you want. It is highly recommended that Perl source code file should has extension *.pl or *.ple (Perl executable).
When you click Run > Run or press F9, the program will launch and print the message “Hello World!”
Let's look at the program in more details.
- The first line of the program is a special comment. Comments in Perl program start from the pound sign (#) to the rest of line. There is no sign for block comment. On UNIX systems, two characters #! starting in a line indicates the program is stored in the file /usr/bin/perl
- The second line starts with print statement followed by a string “Hello World” and then followed by a semi-comma. Every Perl statement has to be ended with a semi-comma (;).
- You can also launch Perl program by double click on the source code file. There is no *.exe or *.dll file when you write Perl programs. If you want to distribute Perl program just copy the source code to other.
In this tutorial, you’ve learn how to write the first Perl program “Hello World”. You’ve also learned how to launch it in through IDE and source code file. Let’s go to the next tutorials to learn Perl in depth.