First Perl Program

Hi guys, in this post we will learn how to develop Perl program, we will create a Perl file and print a statement.

Create a new directory eg: perlapp and then create a perl file eg: first.pl. save perl file with pl extension.

E:\perlapp\first.pl

#!/usr/bin/perl
use warnings;
print("My first programm in perl")

Run program: Open command prompt and type “perl path_of_file”.

/> perl first.pl

Output:

Let’s understand the program line by line.

#!/usr/bin/perl

First line begins with #! Characters. It “#!” tells to the shell to execute the program with Perl interpreter.

use warnings;

It’s called pragma in Perl which instruct to turn on the warning report.

print("My first programm in perl")

In Perl print() function is used to output the string, string must be placed inside quotes.

If you have any question, please comment.

Keep Learning 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *