150 likes | 274 Views
PERL. Prepared by :- ROCKS. Introduction. The full name of PERL is Practical extraction and report language. It is similar to shell script and lot easier & powerful language. Perl is free to download from the GNU website so it is very easily accessible.
E N D
PERL Prepared by :- ROCKS
Introduction The full name of PERL is Practical extraction and report language. It is similar to shell script and lot easier & powerful language. Perl is free to download from the GNU website so it is very easily accessible. Perl is also available for MS-DOS,WIN-NT and Macintosh. Perl has many features borrowed from other programming languages.
Cont… The Perl system uses an interpreter, called “perl”. Usually Perl and perl are considered to be the same thing for practical purposes.
Versions of Perl The current versions of Perl are all in the 5.X and 6.X series (6.X was released in 2001). If you have an older version of Perl (such as Perl 4.X), you should upgrade it as many changes were made between releases. In many Operating System Maybe Perl is already installed. Many operating systems such as Linux and UNIX but also Windows NT Resource Kit come with Perl installed.
Cont… You can easily check whether Perl is loaded on your system by opening a console or terminal window and issuing the command: perl –v If you get a version number, Perl is installed. If you get an error message about command not found (or something similar), Perl is not installed.
Where to download? Perl is available free of charge from many public sites. There are several releases of Perl available for different operating systems, so make sure you get a current release. For Linux or UNIX systems, visit perl.com for the latest releases. For Windows systems, you can compile the Perl source code yourself (a hassle) or download a preconfigured Windows release at activestate.com. For Macintosh, visit macperl.com for MacPerl.
What you need in Perl? When you have installed Perl on your system, all you need to use the language is a text editor that can save ASCII files. All Perl scripts are written and saved in ASCII characters.
Comments in Perl All comments in Perl are written starting with a # sign. Anything after the # sign through to the end of the line is ignored by the interpreter. Comments can be placed anywhere on the line, but commands cannot follow a comment on the same line. Multiline comments should have a # symbol as the first character on every line.
Semicolons All valid Perl command lines end in semicolons. Without a semicolon, Perl continues to read onto the next line and doesn’t assume a carriage-return is the end of a statement. Perl uses semicolons in the same way as C,C++,and Java.
Whitespace Whitespace is ignored by the Perl intepreter. You can use whitespace (spaces and tabs) anywhere in your programs to make them more readable. You should use whitespace to help format your scripts to show loops, logic layout, and continuation of statements.
Operators in Perl • Standard Operators :- • + = Addition • - = Substraction • * = Multiplication • / = Division • % = Modulus • ** = Exponent
Cont… • Comparison Operators :- • > = Greater than • < = Less than • >= = Greater or equal • <= = Less or equal • == = Equal to • != = Not equal to
Cont… • String Operators :- • eq= Equal to • ne = Not equal to • gt= Greater than • lt= Less than • ge= Greater or equal • le = Less or equal
Cont… • Boolean Operators :- • && = AND • || = OR