Language Popularity Perl PHP References
Scripting languages: Perl and PHP
Tuukka Haapasalo December 1, 2009
Tuukka Haapasalo Scripting languages: Perl and PHP
Scripting languages: Perl and PHP Tuukka Haapasalo December 1, 2009 - - PowerPoint PPT Presentation
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
Language Popularity Perl PHP References
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References
$_=’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
BEFOREHAND: close door , each window & exit; wait until time.
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
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*). return last victim; package body; exit crypt (time , times & "half a time") & close it , select (quickly) & warn your next victim; AFTERWORDS: tell nobody. wait , wait until time; wait until next year , next decade; sleep , sleep , die yourself , die at last Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Introduction
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Introduction
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Introduction
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Syntax
use strict; my $a = ’Three \\\’s: "\\\\\" ’; my $b = 20\ _000\_000; my $c = 2.5e-3; $b <=> $c; $a cmp ’Two \\\’s: "\\\\" ’; my $greet = "Hi! "; my $name = "Paul"; my $longGreet = $greet x 3; my $hi = $longGreet . $name. ", " . $greet; my $sentence = "${name}’s dog weighs between more than $c pounds."; ($v3 , $v4) = upcase($v1 , $v2 ); # this doesn ’t change $v1 and $v2 sub upcase { return unless defined wantarray ; # void context , do nothing my @parms = @_; for (@parms) { tr/a-z/A-Z/ } return wantarray ? @parms : $parms [0]; } Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Syntax
use strict; my @a = ("three", "word", "array"); my @b = qw/three word array /; my @c = (@a , "and", @b); $a [1] == "word"; $#b == 2; # Index
last entry $#a = 1; # Crops the length
to 2 $#c =
the c array @a = (); # Also clears the array @a = (1 .. 100); @b = (’A’ .. ’Z’); @c = (’01’ .. ’31’); @b = @a[0 .. 4]; # 5 first elements
@c = @a[0, 2, 10]; # Pick some elements Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Syntax
use strict; my %table; $table{’schmoe ’} = ’joe’; $table {7.5} = 2.6; Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Syntax
# Pattern matching if ( $currentLine =~ m/ sought_text /) { ... } # String selection $string =~ m/whatever(sought_text)whatever2 /; $soughtText = $1; # String replacement $string =~ s/ originaltext /newtext /; # Letter -by - letter translation $string =~ tr/[a,e,i,o,u,y]/[A,E,I,O,U,Y]/;
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Syntax
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Syntax
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References Introduction
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
<!--getenv HTTP_USER_AGENT --> <!--ifsubstr $exec_result Mozilla --> Hey , you are using Netscape!<p> <!--endif --> <!--sql database select * from table where user=’$username ’--> <!--ifless $numentries 1--> Sorry , that record does not exist <p> <!--endif exit --> You have <!--$index:0--> credits left in your account.<p> <!--include /text/footer.html --> Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
<? $name = "bob"; $db = "db"; $result = msql($db ,"select * from table where firstname=’$name ’"); $num = msql_numrows ($result ); echo "$num records found!<p>"; $i=0; while($i <$num ); echo msql_result ($result ,$i ,"fullname"); echo "<br >"; echo msql_result ($result ,$i ,"address"); echo "<br >"; $i++; endwhile; > Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
<?php class db { protected static $dbh = false; function connect () { self :: $dbh = new PDO(’mysql:host=localhost;dbname=test ’,’user ’,’pass ’); self ::$dbh -> setAttribute (PDO:: ATTR_ERRMODE , PDO:: ERRMODE_EXCEPTION ); } } class items extends db { function load($name) { if(! self :: $dbh) $this ->connect (); try { if(! self :: $dbh) $this ->connect (); $stmt = self ::$dbh ->prepare("SELECT * FROM items WHERE firstname =: name ORDER by ctime desc"); $ret = $stmt ->execute( array(’name ’=>$name )); } catch ( PDOException $e) { die($e ->getMessage ()); } return $ret; } } $db = new items; $result = $db ->load("bob"); foreach($result ->fetch(PDO :: FETCH_ASSOC ) as $row) { echo <<<EOB {$row[’fullname ’]}<br /> EOB; } ?> Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References History
Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References
[1]
Perl programming documentation, 2009. http://perldoc.perl.org/. Referenced on 9.11.2009. [2]
The timeline of perl and its culture, 2001. http://history.perl.org/PerlTimeline.html. Referenced on 9.11.2009. [3] DedaSys LLC. Programming language popularity, Nov 2009. http://langpop.com/. Referenced on 18.11.2009. [4]
Cpan - comprehensive perl archive network, 2009. http://www.cpan.org/. Referenced on 18.11.2009. [5]
Picking Up Perl. Internet, Jan 2001. http://www.faqs.org/docs/pperl/. Referenced on 9.11.2009. [6]
Performance and security, Mar 2007. http://talks.php.net/show/oscms07/. Referenced on 19.11.2009. [7] NuSphere Corporation. The history of PHP, 2009. http://www.nusphere.com/php/php_history.htm. Referenced on 18.11.2009. Tuukka Haapasalo Scripting languages: Perl and PHP
Language Popularity Perl PHP References
[8] PHP Documentation Group. PHP manual, 2009. http://www.php.net/manual/. Referenced on 18.11.2009. [9]
The Perl scripting language, Dec 2002. http://rockfish-cs.cs.unc.edu/COMP144/IEPerl.pdf. Referenced on 18.11.2009. [10] Tiobe Software. TIOBE programming community index for November 2009, Nov 2009. http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html. Referenced on 18.11.2009. [11] Wikipedia. Perl, 2009. http://en.wikipedia.org/wiki/Perl. Referenced on 9.11.2009. [12] Wikipedia. PHP, 2009. http://en.wikipedia.org/wiki/PHP. Referenced on 9.11.2009. [13] Wikipedia. Schwartzian transform, 2009. http://en.wikipedia.org/wiki/Schwartzian_transform. Referenced on 18.11.2009. Tuukka Haapasalo Scripting languages: Perl and PHP