Language Popularity Perl PHP References Scripting languages: Perl and PHP Tuukka Haapasalo December 1, 2009 Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Outline 1 Language Popularity 2 Perl Introduction History Syntax 3 PHP Introduction History 4 References Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Popularity of Programming Languages [3, 10] Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Perl Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Write-only code? $_=’ev al(" seek \040D ATA ,0, 0;"); foreach (1..3) {<DATA >;}my @camel1hump ;my$camel; my$Camel ;while( <DATA >){ $_=sprintf ("% -6 9s",$_); my@dromedary 1= split (//); if(defined($ _=<DATA >)){ @camel1hum p=split (//);} while(@dromeda ry1 ){ my$camel1hump =0 ;my$CAMEL =3; if(defined($_=shif t( @dromedary1 ))&&/\S/){ $camel1hump +=1<< $CAMEL ;} $CAMEL --;if(d efined($_=shift( @dromedary1 ))&&/\S/){ $camel1hump +=1 <<$CAMEL ;}$CAMEL --;if(defined($_=shift( @camel1hump ))&&/\S/){ $camel1hump +=1<< $CAMEL ;} $CAMEL --;if( defined($_=shift( @camel1hump ))&&/\S/){ $camel1hump +=1<< $CAME L;;} $camel .=( split (// ,"\040..m‘{/J\047\134}L^7FX "))[ $camel1h ump ];} $camel .="\n";} @camel1hump =split (/\n/,$camel ); foreach(@ camel1hump ){ chomp;$Camel=$_;y/LJF7 \173\175 ‘\047/\061\062\063\ 064\065\066\067\070/; y/12345678/ JL7F \175\173\047 ‘/; $_=reverse; print"$_ \040 $Camel\n";} foreach(@camel1hump ){ chomp;$Camel=$_;y /LJF7 \173\175 ‘\047/12345678/; y/12345678/ JL7F \175\173\0 47 ‘/; $_=reverse;print "\040 $_$Camel\n";}’;; s /\ s *//g;; eval ; eval ("seek \040 DATA ,0 ,0;"); undef$ /;$_=<DATA >; s /\ s *//g;( );; s ;^.*_;;; map { eval "print \"$_\"";}/.{4}/g; __DATA__ \124 \1 50\145\040\165\163\145\040\157\1 46\040\1 41\0 40\143\141 \155\145\1 54\040\1 51\155\ 141 \147\145\0 40\151\156 \040\141 \163\16 3\ 157\143\ 151\141\16 4\151\1 57\156 \040\167 \151\164\1 50\040\ 120\1 45\162\ 154\040\15 1\163\ 040\14 1\040\1 64\162\1 41\144 \145\ 155\14 1\162\ 153\04 0\157 \146\ 040\11 7\047\ 122\1 45\15 1\154\1 54\171 \040 \046\ 012\101\16 3\16 3\15 7\143\15 1\14 1\16 4\145\163 \054 \040 \111\156\14 3\056 \040\ 125\163\145\14 4\040\ 167\1 51\164\1 50\0 40\160\ 145\162 \155\151 \163\163 \151\1 57\156\056 Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Black Perl BEFOREHAND: close door , each window & exit ; wait until time . open spellbook , study , read (scan , select , tell us); write it , print the hex while each watches , reverse its length , write again; kill spiders , pop them , chop , split , kill them. unlink arms , shift , wait & listen (listening , wait ), sort the flock (then , warn the "goats" & kill the "sheep"); kill them , dump qualms , shift moralities , values aside , each one; die sheep! die to reverse the system you accept (reject , respect ); next step , kill the next sacrifice , each sacrifice , wait , redo ritual until "all the spirits are pleased"; do it ("as they say"). do it(* everyone *** must *** participate *** in*** forbidden ** s *e*x*). victim; package body; return last crypt ( time , times & "half a time") & close it , exit select (quickly) & warn your victim; next AFTERWORDS: tell nobody. wait , wait time ; until next year , next decade; wait until sleep , sleep , die yourself , die at last Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Introduction Introduction Perl was originally developed by Larry Wall, a linguist working as a systems administrator for NASA [11]. Perl is based on languages including C, shell scripting (sh), AWK, and sed (and Pascal, and BASIC|PLUS, . . . ). Initial purpose was to be a replacement for an overtaxed awk. Wall used Perl as a general-purpose Unix scripting language to make report processing easier. Perl slogans [5] There’s more than one way to do it. Perl makes easy jobs easy, and the hard jobs possible. Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Introduction Usage of Perl Used for easy manipulation of text files, graphics programming, system administration, network programming, applications that require database access and CGI programming on the Web [11]. Nicknamed "the Swiss Army chainsaw of programming languages" due to its flexibility and adaptability. See an introduction to Perl by Stotts [9]. Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Introduction Etymology Etymology Perl was originally named Pearl, after the Parable of the Pearl from the Gospel of Matthew. [11] Name arbitrarily chosen for its positive connotations. Renamed to Perl to differentiate from the existing programming language PEARL. Common acronyms coined afterwards (from Perl man pages): Practical Extraction and Report Language Pathologically Eclectic Rubbish Lister Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History History of Perl [2] 1987 Perl 1.000 released. 1988 Perl 2.000 released. 1989 Perl 3.000 released, first public Perl tutorial. 1990 Convex (computer vendor) includes Perl as part of its standard OS distribution. 1991 Perl 4.000 released, Programming Perl (1 st edition) published. 1992 First release of MacPerl. 1994 Perl 5.000 released. 1995 CPAN (Comprehensive Perl Archive Network) introduced to the Perl community. 1996 Doug MacEachern introduces mod_perl, which embeds a Perl interpreter into an Apache module. 1998 The movie Sphere is released featuring a small snippet of code from the Perl FAQ. Full release history found in Perl Programming Documentation [1]. Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History Important people Larry Wall , author of Perl, a linguist working as systems administrator for NASA. Author also of rn (Usenet client) and patch . Co-author of Programming Perl (the Camel book ). Randal Schwartz a.k.a. merlyn , author of most Perl programming books. Author of the Schwartzian transform. Popularized the Just another Perl hacker signatures. Jarkko Hietaniemi , creator and self-appointed master librarian of CPAN, author of several Perl modules, maintainer of Perl. Schwartzian transform [13] @sorted = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [$_, foo($_)] } @unsorted; Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History Perl 1.000, 1987 DESCRIPTION Perl is a interpreted language optimized for scanning arbi- trary text files, extracting information from those text files, and printing reports based on that information. It’s also a good language for many system management tasks. The language is intended to be practical (easy to use, effi- cient, complete) rather than beautiful (tiny, elegant, minimal). It combines (in the author’s opinion, anyway) some of the best features of C, sed, awk, and sh, so people familiar with those languages should have little difficulty with it. (Language historians will also note some vestiges of csh, Pascal, and even BASIC|PLUS.) Expression syntax corresponds quite closely to C expression syntax. If you have a problem that would ordinarily use sed or awk or sh, but it exceeds their capabilities or must run a little fas- ter, and you don’t want to write the silly thing in C, then perl may be for you. There are also translators to turn your sed and awk scripts into perl scripts. OK, enough hype. Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History Perl 2.000, 1988 Recursive subroutine calls. Local variables in blocks, subroutines and evals. The manual is now not lying when it says that perl is generally faster than sed. I hope. -- Elaine Ashton [2] Assignments can function as lvalues, so you can say things like ($HOST = $host) =~ tr/a-z/A-Z/; ($obj = $src) =~ s/\.c$/.o/; Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History Perl 3.000, 1989 Correct binary data handling, functions to pack and unpack binary structures into arrays or lists. Passing values to subroutines by reference. List chopping. New functions: mkdir and rmdir , getppid , getpgrp and setpgrp , getpriority and setpriority , chroot , ioctl and fcntl , . . . Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History Perl 4.000, 1991 No major changes in the language. Programming Perl released and became the de facto standard for the language. Perl version number changed to identify the version documented by the book. Tuukka Haapasalo Scripting languages: Perl and PHP
Recommend
More recommend