Perl

1,167 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,167
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Perl

  1. 1. (the language for getting your job done) Internet Programming Diana Hingst
  2. 2. <ul><li>Dynamic programming language </li></ul><ul><li>Intended to be practical (easy to use & efficient) </li></ul><ul><li>Widely adopted for its text processing </li></ul><ul><li>One of “The Three P’s” (Perl, PHP, Python) for writing web applications </li></ul>
  3. 3. <ul><li>File system manipulation </li></ul><ul><li>Database administration </li></ul><ul><li>Client-server programming </li></ul><ul><li>Secure programming </li></ul><ul><li>Object-oriented programming </li></ul><ul><li>GUI development </li></ul>
  4. 4. <ul><li>Created by Larry Wall in 1987 </li></ul><ul><li>Designed as a glue for Unix OS </li></ul><ul><li>Originally named “PEARL” </li></ul>Figure 1: Larry Wall
  5. 5. <ul><li>First Edition published in 1991 as a reference guide to Perl. </li></ul><ul><li>Previously, documentation was a single (very long) man page. </li></ul><ul><li>Perl 4 released. </li></ul>Figure 2: Programming Perl Cover
  6. 6. <ul><li>http://www.cpan.org/ </li></ul>
  7. 7. <ul><li>Answer: Both </li></ul><ul><li>Compiles into an intermediate format </li></ul><ul><ul><li>Optimizes & gives instant feedback </li></ul></ul><ul><li>Interprets the intermediate format to execute </li></ul>
  8. 8. <ul><li>#Comment </li></ul><ul><li>$number = “4”; </li></ul><ul><li>$string = “3 apples”; </li></ul><ul><li>@array = (“couch”, “movie”, “drink”); </li></ul><ul><li>%hash = (joe => ‘red’, sam => ‘blue’); </li></ul><ul><li>$a ** $b #a^b </li></ul><ul><li>$a . $b #String Concatenation </li></ul><ul><li>$a x $b #Repeat a b times </li></ul>
  9. 9. <ul><li>$camels = ‘123’; </li></ul><ul><li>print $camels + 1; # Prints 124 </li></ul><ul><li>$a = “8”; </li></ul><ul><li>print $a + “1”; # Prints 9 </li></ul><ul><li>print $a . “1”; # Prints 81 </li></ul>
  10. 10. <ul><li>Open a text editor </li></ul><ul><li>Save with file extension .pl (or .cgi) </li></ul><ul><li>We’ve located the PERL interpreter and told it we’re going to be working with a web browser or in a web environment </li></ul>
  11. 11. <ul><li>Upload it to your web server </li></ul><ul><li>Run the program in one of three ways </li></ul><ul><ul><li>Link to it </li></ul></ul><ul><ul><ul><li><a href=myscript.cgi>Click Here</a> </li></ul></ul></ul><ul><ul><li>Write it into your HTML file </li></ul></ul><ul><ul><ul><li><p><!--#include virtual=“myscript.cgi”--> </li></ul></ul></ul><ul><ul><li>Action item of a form </li></ul></ul><ul><ul><ul><li><form action=myscript.cgi> </li></ul></ul></ul><ul><ul><li>Unix command line </li></ul></ul><ul><ul><ul><li>perl myscript.cgi </li></ul></ul></ul>
  12. 12. <ul><li>Perl Code </li></ul><ul><li>HTML Code </li></ul>
  13. 13. <ul><li>Data Tracing Mechanism </li></ul><ul><ul><li>Automatically determines which data was derived from insecure sources </li></ul></ul><ul><li>Specially Protected Compartments </li></ul><ul><ul><li>Able to safely execute Perl code that may be dangerous/insecure </li></ul></ul>
  14. 14. <ul><li>Rotate Banners </li></ul><ul><li>Generate Text & HTML on the fly </li></ul><ul><li>Set Cookies </li></ul><ul><li>Provide Shopping Carts </li></ul>
  15. 15. <ul><li>Amazon.com </li></ul><ul><li>LiveJournal.com </li></ul><ul><li>Ticketmaster.com </li></ul><ul><li>IMDb.com </li></ul>
  16. 16. <ul><li>Writing poems that can actually be compiled as legal Perl code. </li></ul><ul><li>if ((light eq dark) && (dark eq light) </li></ul><ul><li>&& ($blaze_of_night{moon} == black_hole) </li></ul><ul><li>&& ($ravens_wing{bright} == $tin{bright})){ </li></ul><ul><li>my $love = $you = $sin{darkness} + 1; </li></ul><ul><li>}; </li></ul>
  17. 17. <ul><li>Programming Perl 2 nd Edition </li></ul><ul><li>http://websitehelpers.com/perl/ </li></ul><ul><li>http://www.tizag.com/perlT/index.php </li></ul><ul><li>http://www.linuxjournal.com/article/3394 </li></ul><ul><li>http://en.wikipedia.org/wiki/Larry_Wall </li></ul><ul><li>http://en.wikipedia.org/wiki/Perl </li></ul><ul><li>http://www.foo.be/docs/tpj/issues/vol5_1/tpj0501-0012.html </li></ul>

×