Tuesday, 11 March 2014

INTRODUCTION



Perl introduction:
Practical Extraction and Report Language (Perl) is one of the most widely used languages for web programming today.
Larry Wall began developing this high level programming language in 1987, while working at Unisys.
Perl possesses simple, yet powerful, text-processing capabilities and is arguably the most popular CGI scripting language.
A Perl program consists of a sequence of declarations and statements which run from the top to the bottom. Loops, subroutines, and other control structures allow you to jump around within the code. Every simple statement must end with a semicolon (;).
Perl is a free-form language: you can format and indent it however you like. White space serves mostly to separate tokens.

First Perl Program

#! /usr/bin/perl
 
# This will print "Hello, World"
print "Hello, world\n";
 
Here /usr/bin/perl is actual Perl interpreter binary. 
This execution will produce following result:
Hello, world
You can use parentheses for functions arguments or omit them according to your personal taste. They are only required occasionally to clarify issues of precedence. Following two statements produce same result.
print("Hello, world\n");
print "Hello, world\n";

Perl File Extension

A Perl script can be created inside of any normal simple-text editor program. There are several programs available for every type of platform. There are many programs designed for programmers available for download on the web.
Regardless of the program you choose to use, a Perl file must be saved with a .pl or .PL file extension in order to be recognized as a functioning Perl script. File names can contain numbers, symbols, and letters but must not contain a space. Use an underscore (_) in places of spaces.

No comments: