Transcript PERL

Drew Murphy
Drew Ebelhar
History
 December 18, 1987
 Creator- Larry Wall
 Objective: To develop a
general purpose Unix
scripting language to make
report processing easier.
 Gained widespread
popularity in the late ‘90s as a
CGI scripting language.
 Perl 5 is the latest version,
with Perl 6 currently under
development.
Changes from 5 to 6
 Most changes attempt to normalize language.
 Adds static typing to the already present dynamic
typing.
 Makes object-oriented programming easier.
 Introduces feature similar to interfaces in Java.
 Syntactical simplification.
Brief Overview
 Perl is a high-level general purpose Unix based




scripting language
Named “Perl” after the Parable of the Pearl in the
Gospel of Matthew.
Occasionally backronymed Practical Extraction and
Report Language.
Derived heavily from C.
Together with Python and PHP, form the three P’s of
the internet, which denote the most popular dynamic
languages for writing web applications.
Functional







TEXT MANIPULATION
CGI scripting
Graphics programming
System administration
Network programming
Bioinformatics
Lovingly referred to as the “Swiss army chainsaw of
programming languages”, as well as the “duct tape that
holds the internet together”.
Who’s using Perl?
 Amazon
 Craigslist
 IMDb
 Yahoo
 Priceline
Design
 While Fortran and C attempt to make efficient use of
the expensive hardware, Perl makes efficient use of
expensive programmers by making code easy to
write.
 Perl is extremely generous to the programmer at the
expense of CPU and memory resources
 The compiler is very forgiving and as a result
debugging can be difficult
 Does not enforce any particular
paradigm(procedural,OOP,functional)
Sample Program – Hello World
#!/usr/bin/perl
use strict;
use warning;
my $hello = "Hello World!";
print $hello;
Some Code
$ perl myscript.pl
$myVar = 10;
$myOtherVar = 9;
$myString = “Some string.\n”;
@someArray = (“An”,”Array”,”of”,”Strings”);
print(“@someArray”);
if($myVar != $myOtherVar) {
print(“Ten does most definitely not equal
nine.\n”);
else {
print(“The universe exploded.\n”); }
for $p (1..10) {
print(“$p\n”); }
Readability
 Pros
 None.
 Cons
 Usually many ways to accomplish an operation.
 Tolerates exceptions to its rules.
 Large number of language primitives.
Writability
 Pros
 Easy to learn, yet extensive.
 Supports many programming paradigms, such as
objected-oriented, procedural, and functional
programming.
 Many built-in functions, such as sorting.
 Can interact with other languages within code.
 Cons
 No writing standard for the language exists.
Reliability
 Pros
 Dynamic type checking.
 Cons
 Doesn’t require variable declaration unless the “use
strict;” command is used.
 Compiler is not strict, so bugs are difficult to find when
present.
Cost
 Pros
 Easy to learn, so cost of training programmers is cheap.
 Free
 Uses hybrid implementation system, so compilation
time is faster.
 Available on many platforms.
 Cons
 Difficult to maintain or update programs, as there is
generally poor readability.
References
http://en.wikipedia.org/wiki/Perl
http://en.wikipedia.org/wiki/Perl_6
http://www.perl.org/
http://perl-begin.org/learn/Perl-perl-but-not-PERL/
http://perl-begin.org/tutorials/perl-for-newbies/part1/
http://www.tizag.com/perlT/perlarrays.php