PoiNtEr->: PerL

                             Difference between a dream and an aim. A dream requires soundless sleep, whereas an aim requires sleepless efforts.

Search This Blog

Tuesday, January 18, 2011


What Is Perl?

Perl is an acronym, short for Practical Extraction and Report Language. It was designed by Larry Wall as a tool for writing programs in the UNIX environment and is continually being updated and maintained by him. For its many fans,

* Perl provides the best of several worlds. For instance: Perl has the power and flexibility of a high-level programming language such as C. In fact, as you will see, many of the features of the language are borrowed from C.

* Like shell script languages, Perl does not require a special compiler and linker to turn the programs you write into working code. Instead, all you have to do is write the program and tell Perl to run it. This means that Perl is ideal for producing quick solutions to small programming problems, or for creating prototypes to test potential solutions to larger problems.

* Perl provides all the features of the script languages sed and awk, plus features not found in either of these two languages. Perl also supports a sed-to-Perl translator and an awk-to-Perl translator.

In short, Perl is as powerful as C but as convenient as awk, sed, and shell scripts.

Writing your first perl program


2.# A simple perl program to print the user input

3.print ("Hello, type in something\n");


5.print ($inputline);

Lets split up the code and see what each line does..


# Says this line is a comment and there are no executable instructions on this line

! Says this is a perl script

/usr/bin/perl give the location of the perl interpreter, many programing books mention the location as usr/local/bin/perl, but this is not correct in ubuntu. In ubuntu Perl interpreter is located at usr/bin/perl.

print “Hello, type in something\n”;

This line just prompts to user to type something, similar to printf statement in C.


Here we are setting a variable named inputline, and storing the input from the keyboard into that variable. <stdin> takes the input from the keyboard.

print ($inputline);

This line echoes the typed in message


open terminal and give following command

perl hello.pl

here hello is the name of above file which contain code in perl language

No comments:

Post a Comment