This tutorial explains how to write a simple hello world program in Perl Scripting language.
Hello world is the first program written by developers to learn any new programming language.
It is easy and quick to code a language in Perl.
This post covers
- Writing a simple hello world program in Perl
- Print the Hello World to console
- Compile and execute a program using the command line.
Perl Hello World Example program
To write a hello world program, Please follow the below steps
- Open any text editor
- Create a file called
HelloWorld.pl, where ml is an extension for OCaml code.
- Add the below lines of code
# HelloWorld.pl Hello World application print "Hello World application" = Hello world sample program Basic program to print hello world to console First code to write in Perl programming language =cut print "Hello World app" ;
Comments are single-line or block/multi-line comments and are ignored by the python interpreter.
Single lines are started with
#, followed by single-line text, and end with a line.
Multi-line comments span in multiple lines, starting with
= and ending with
=cut and each line contains a comment string
There is no main function in
How to compile and execute the program in Perl
Perl language has an interpreter(
Once you installed the perl language, the perl command is available on command line
Below command used to execute a perl code
It prints the string to the console.