COOL History Ease of use Portability Standard Security

COOL � History � Ease of use � Portability � Standard � Security & Privacy � User support � Application &Popularity Today � Ten Most Popular Programming Languages

� Practical Extraction & Report Language(PERL) � Developed � by Larry Wall in 1987 Combined features of C, awk, Sed, Bourne � Efficient use for manipulation of text files. � Efficient use for report processing � Motto: “there is more than one way to do it” � Contains multiple versions


� Very easy to use and understand � Designed � Has with syntax similar to human language features that make it easy to program ex: �Automatic memory management �List �Dynamic �Regular Typing Expression allow manipulation of text

� Among the most portable programming languages � Can be compiled over 70 Operating Systems � Can pick up a Perl program and compile it on another computer � Almost no need to modify the program

� Keywords � Instructions � Print, Perl recognizes and understand. Ex: Die, Return � Should not be re � Statements � Print: “hello world/n” � Blocks � Enclosed in braces { print “This is”; print “a block”; print “of statements”; }

� Perl 1. has 3 basic types of variables Scalar Holds a single type of value, preceded by a dollar sign Can be a string, a number, or a reference $foo = 1; Types of value that can be assigned to a number : • 12345 # integer • -54321 # negative integer • 12345. 67 # floating point • 6. 02 E 23 # scientific notation • 0 xffff # hexadecimal

� Perl has 3 basic types of variables 2 - Arrays • holds multiple values, preceded by the @ sign @color ={ “red”, “blue”, “green”}; • Its index start at 0, print the first element of array print “$color[0]n”; // to print red

� Perl has 3 basic types of variables 3 - Hash ü Unordered collection of values ü Each value can be retrieved by its key ü Hash name is preceded by a % sign ü Declared by : Hash Name -> Key -> Value % pages = ( "fred", "http: //www. cgi 101. com/~fred/", "beth", "http: //www. cgi 101. com/~beth/", "john", “http: //www. cgi 101. com/~john/" );

� Perl �If also contains: … else statements § If( expression) {execute this} else {execute this}; �More than four different types of loop § While loop § Foreach loop § Until loop

� Perl also contains �Control commands Last: terminates the execution of a loop Next: makes the loop go to its next iteration Redo: makes loop restart without evaluating loop conditions �Modifiers Allow any statement to loop based on some conditions Ø Statements if expression Ø Statements until/unless expression Ø Statements while expression

� Perl also contains �Regular Expressions They are String literals Used to find and replace strings by using patterns s/pattern/replace/ ->searches $_ by default, replace �Subroutines Defined using keyword sub (name) {block}; $subref=sub{block}; #creates anonymous subroutine

� Privacy ü is not enforced in Perl “Perl does not enforce private and public part of its module as …in…C++, Ada, Modula-17” ü Module is a fundamental unit of code reuse in Perl � Security � Perl has features that make it secure � Can handle insecure data by using Taint mode � Taint mode can be set automatically � Things that come outside your program is tainted � Tainted data are restricted in what they can do

� Has a vast community of support that has Ø User o Groups Have mongers in many cities around the world Ø Workshops o Teach Perl during workshops at different level Ø Hackathons o Perl hackers gather to hack on specific projects for days Ø Two Major Annual Conventions o Perl Conference o Yet Another Perl Conference (YAPC)

� Application �Used to write CGI scripts �Popular �Many for writing web applications large projects are written in Perl Cpanel, a UNIX web based hosting panel Bugzilla, web tracker developed by Mozilla Twiki, Perl based structured wiki application Amazon, Priceline, Craigslist Popularity § Perl is the 8 th top programming language in 2010

- Slides: 16