Thursday, November 11, 2010

PERL

- Practical Extraction and Reporting Language.

- Created by Larry Wall in 1987.

- Helps in Extraction for looking into files and pulling out the important parts and report for generating output and well reports based on the information that was found.

- Practical Language because it’s much easier to write the programs in Perl.

- Scripts are written in plain text and used in the form without compilation into bytes.

Syntax Rules:

* All Perl Scripts begin with “She-Bang”. Ie., # - sh and ! – bang
* Then followed by the path of Perl interpreter.

* A semi-colon (;) must terminate each statement.

* Perl is Case sensitive.

* Spaces, tabs and newlines are collectively known as “white space” and ignored by Perl.

* Adding comments to Perl code is often useful as explanation. Add comments using “#”. The perl will ignore it.

* Quotes within quotes should be escaped with a preceding backslash to prevent the text string terminating prematurely. For this single quote can be used.

Why do we learn Perl?

Ø Useful for extracting datas.

Ø Doesn’t need any fancy softwares.

Ø Can program perl quikly.

Ø Portable.

Ø Powerful.

Ø Flexible.

Ø Easy to learn.

Ø
Perl community is out there.

Sample Script: hello.pl

#! /usr/bin/perl –w

Print “Hello World!\n”;

No comments:

Post a Comment