June 12, 2021

Perl Basics for Beginners

Perl Basics for Beginners

Perl Basics for Beginners

Perl was the first popular solution for writing CGI scripts and even large scale web applications, and is still very popular. It is extensively used by such large, highly scalable sites. Perl is a great first language for people with no programming experience. It is easy to install, and actually comes pre-installed on most non-Windows operating systems. It has a very open syntax which, although very complex, is also very forgiving.

Perl is a flexible, feature-rich and powerful dynamic programming language. Perl code is very concise and can be written very quickly, while still performing well in most cases. One can often achieve in one line of Perl what requires 100s of lines in C and other languages.

Perl is available on almost every Unix system, and is easily installable on Microsoft Windows. It is more robust and more portable for many tasks than writing Unix shell scripts.

Perl has an extensive set of tools for automated or semi-automated software testing. These tools can often be used to test applications written in other languages, and certainly network server.

Perl is a friendly language. It plays well with your personal programming style.

Functions and Statements:

Perl has a rich library of functions. They’re the verbs of Perl, the commands that the interpreter runs. You can see a list of all the built-in functions on the perlfunc main page. Almost all functions can be given a list of parameters, which are separated by commas.

The print function is one of the most frequently used parts of Perl.

A Perl program consists of statements, each of which ends with a semicolon. Statements don’t need to be on separate lines; there may be multiple statements on one line or a single statement can be split across multiple lines.

Numbers, Strings and Quotes:

There are two basic data types in Perl: numbers and strings.

Numbers are easy; we’ve all dealt with them. The only thing you need to know is that you never insert commas or spaces into numbers in Perl.

Strings are a bit more complex. A string is a collection of characters in either single or double quotes. The difference between single quotes and double quotes is that single quotes mean that their contents should be taken literally, while double quotes mean that their contents should be interpreted.


If functions are Perl’s verbs, then variables are its nouns. Perl has three types of variables: scalars, arrays and hashes. Think of them as “things,” “lists,” and “dictionaries.” In Perl, all variable names are a punctuation character, a letter or underscore, and one or more alphanumeric characters or underscores.

Scalars are single things. This might be a number or a string. The name of a scalar begins with a dollar sign, such as $i or $abacus.

Numbers in Perl can be manipulated with the usual mathematical operations: addition, multiplication, division and subtraction.

Arrays :
Arrays are lists of scalars. Array names begin with @. You define arrays by listing their contents in parentheses, separated by commas. Arrays always return their contents in the same order;


Almost every time you write a program, you’ll need to use a loop. Loops allow you run a particular piece of code over and over again. This is part of a general concept in programming called flow control.

Perl has several different functions that are useful for flow control, the most basic of which is for. When you use the for function, you specify a variable that will be used for the loop index, and a list of values to loop over. Inside a pair of curly brackets, you put any code you want to run during the loop.

For Perl Online Training please visit http://www.revanthtechnologies.com