Published on

Published in: Education
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Introduction To PERL Language Abhishek Pachisia B.Tech-IT (4th yr)
  2. 2. FOREWORD Original name Pearl. Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl is a programming language suitable for writing simple scripts as well as complex applications. Perl is not officially an acronym. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language According to Wall, Perl has two slogans.  "Theres more than one way to do it“.  "Easy things should be easy and hard things should be possible"
  3. 3. BRIEF HISTORY PERL 1 - Released on December 18, 1987. PERL 2 - Released in 1988. Better regular expression engine. PERL 3 - Released in 1989. Support for binary data streams. PERL 4 - Released in 1991. To identify the version. Programming Perl -1991. Known as Camel Book. PERL 4.036 – Released in 1993. CPAN – 26 October, 1995.
  4. 4. VERSIONS OF PERL 5 PERL 5 porters – Released on May,1994. PERL 5.000 - October 17,1994. Rewrite of the interpreter + Many new features. PERL 5.001 - March 13,1995. PERL 5.002 - February 29,1996. New prototypes feature PERL 5.003 - June 25,1996. Security release. PERL 5.004 - May 15,1997.Included UNIVERSAL package PERL 5.005 - July 22,1998.Regex engine PERL 5.6 – March 22,2000. 64-bit support, Unicode string representation etc.
  5. 5. SYMBOLS Dromedary Camel  Non-Commercial. Onion  Licenses to its subsidiaries.
  6. 6. FEATURES The overall structure of Perl derives broadly from C. Perl also takes features from shell programming. All variables are marked with leading sigils. It has many built-in functions. Perl takes  Lists from Lisp,  Hashes ("associative arrays") from AWK, and  Regular expressions from sed.
  7. 7. FEATURES THAT EASE TASK OF PROGRAMMER Automatic memory management, Dynamic typing, Strings, Lists, and hashes, Regular expressions, Introspection and An eval() function.
  8. 8. DESIGN - 1 Response to three broad trends in the computer industry –  Falling hardware costs,  Rising labour costs, and  Improvements in compiler technology. Make efficient use of expensive computer- programmers. No built-in limits similar to the Zero One Infinity rule. Syntax reflects the idea that "things that are different should look different”
  9. 9. DESIGN - 2 Perl favours language constructs that are concise and natural for humans to write. Perl does not enforce any particular programming paradigm. Not a tidy language. Resolve syntactical ambiguities. No written specification/standard through Perl 5 That interpreter, together with its functional tests, stands as a de facto specification of the language.
  10. 10. IMPLEMENTATION - 1 Implemented as a core interpreter, written in C. The interpreter is 150,000 lines of C code and compiles to a 1 MB executable on typical machine architectures. The interpreter has an object-oriented architecture. All of the elements are represented in the interpreter by C structs. The life of a Perl interpreter divides broadly into a compile phase and a run phase. In compile phase , Compilation occurs. In run phase, Execution occurs.
  11. 11. IMPLEMENTATION-2 At compile time, the interpreter parses Perl code into a syntax tree. At run time, it executes the program by walking the tree. Text is parsed only once, and the syntax tree is subject to optimization before it is executed. It is often said that “Only Perl can parse Perl”. Perl makes the unusual choice of giving the user access to its full programming power in its own compile phase. The cost in terms of theoretical purity is high, but practical inconvenience seems to be rare.
  12. 12. CPAN Comprehensive Perl Archive Network. An archive of over 114,000 modules of software written in Perl, as well as documentation for it. CPAN can denote  Archive network itself, or  The Perl program that acts as an interface to the network and as an automated software installer Most software on CPAN is free and open source software. Components:  Mirrors  Search engines  Testers  and CPANPLUS
  13. 13. COMPLEX PERL PROGRAM#!/usr/bin/perluse strict;use warnings;use Time::HiRes qw(sleep time);use POSIX qw();use IO::Handle;my $delay = shift(@ARGV);STDOUT->autoflush(1);{ my $start = time(); my $end = $start + $delay;
  14. 14. my $last_printed; while ((my $t = time()) < $end) { my $new_to_print = POSIX::floor($end - $t); if (!defined($last_printed) or $new_to_print != $last_printed) { $last_printed = $new_to_print; print "Remaining $new_to_print/$delay", x 40, "r"; } sleep(0.1); }}print "n";