Dive into Perl
       Ralph Wen
 Ralph.Wen@gmail.com
        4/9/2009
while (<>) {
  print “welcome!n”
     if /perl/;
}
#!/usr/bin/perl

                    $_='
                    dw`m
                  !#cholned!]y
                z42|]yz4...
So what is Perl?
Perl is…
•   A pearl without the ‘a’
•   A computer language (Perl)
•   A interpreter (perl)
•   Pathologically Eclectic R...
What’s Perl used for?
•   Text processing
•   System administration
•   CGI and web programming
•   Database interaction
•...
What is Perl like?
What is Perl like?
•   High level
•   General purpose
•   Interpreted
•   Dynamic
•   Fast
•   Open source
•   Mature…
Perl’s “philosophy”
•   Scripting, programming, hacking and coding
•   There's more than one way to do it
•   Pandora's bo...
Okay, now let’s dive into Perl!
Hello World!




print ‘hell!’
Hello again!
#!/usr/bin/perl
use strict;
use warnings;

my $greeting = “Hello Earth!n”;

print $greeting;

exit;
Hello?
Hello/World.pm                                    hello_world.pl
package Hello::World;                             ...
Just show me the gory details!!
Well, get ready! It’s a long and harsh journey!
But we’ll be running out of time..

             So..
You are encouraged to learn the syntax
             by yourself!
Demo – Finding Duplicate Files*
• Source code (link)
• Demo Video (link)




 *Courtesy to “Wicked Cool Perl Scripts” by S...
Somebody said Perl sucks?
• Ugly
• Illegible syntax
• Hard to maintain
• Lack of method
  signatures
• Not a real OOPL


F...
When to use Perl for us?
• Processing test results
• Installing recurrent
  builds
• Performing repetitive
  test steps
• ...
Want more fun with Perl?
Online tutorials
• perlintro
  – http://perldoc.perl.org/perlintro.html

• perltut
  – http://perldoc.perl.org/index-tutor...
Books
•   Comprehensive Archive Networks
•   Hosts over 15,400 Perl modules
•   Has more than 250 mirrors across the world
•   O...
User Communities
• PerlMonks:
  – http://www.perlmonks.org/

• use Perl;
  – http://use.perl.org/

• Perl Mongers:
  – htt...
Dive Into Perl
Upcoming SlideShare
Loading in...5
×

Dive Into Perl

11,060

Published on

A brief intro for Perl. Basic knowledge of programming is required.
For more info contact ralph dot wen at gmail dot com

Published in: Technology, Business
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
11,060
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Dive Into Perl

  1. 1. Dive into Perl Ralph Wen Ralph.Wen@gmail.com 4/9/2009
  2. 2. while (<>) { print “welcome!n” if /perl/; }
  3. 3. #!/usr/bin/perl $_=' dw`m !#cholned!]y z42|]yz45|]yz55|]yz 5g|]yz44|]yz45|-&;tug9& #:lx)L%j-%h-%k-%s-%y-%x(:g ns%x)X, 04//05(zgns%y)1//68(zqshou# ]dZ#-%j'04?6 >0;1-#:2#- %j$6-#l]yz372`|#:  gns)%h<%j<%s<1:%k<%s+%s,%h+%h,3*%y.34-%h<3+%s+%h* %x.01-%k+REKCAHX%k*%hJUST+%h=00'ANOTHER' %jPERL* *=000:%s<%k(zqshouHACKER##: |||qshou#]dZ1l#:';s<s+> <>gme;y/101-130//d; s/(.)/chr(ord($1 )^0x1)/ge; eval ;qaa
  4. 4. So what is Perl?
  5. 5. Perl is… • A pearl without the ‘a’ • A computer language (Perl) • A interpreter (perl) • Pathologically Eclectic Rubbish Lister • Practical Extraction and Report Language • …but never PERL
  6. 6. What’s Perl used for? • Text processing • System administration • CGI and web programming • Database interaction • … and, test automation!
  7. 7. What is Perl like?
  8. 8. What is Perl like? • High level • General purpose • Interpreted • Dynamic • Fast • Open source • Mature…
  9. 9. Perl’s “philosophy” • Scripting, programming, hacking and coding • There's more than one way to do it • Pandora's box • Knowledge socialism • ..and, this guy is the philosopher!
  10. 10. Okay, now let’s dive into Perl!
  11. 11. Hello World! print ‘hell!’
  12. 12. Hello again! #!/usr/bin/perl use strict; use warnings; my $greeting = “Hello Earth!n”; print $greeting; exit;
  13. 13. Hello? Hello/World.pm hello_world.pl package Hello::World; #!/usr/bin/perl use strict; use Hello::World; use warnings; print hello(); our $VERSION = ‘1.00’; print hello(quot;Milky Wayquot;); use base ‘Exporter’; =head1 NAME Hello::World - an encapsulation for hello world =cut sub hello { my $target=shift; $target=‘world’ unless defined $target; return “Hello, $target!”; } 1;
  14. 14. Just show me the gory details!!
  15. 15. Well, get ready! It’s a long and harsh journey!
  16. 16. But we’ll be running out of time.. So..
  17. 17. You are encouraged to learn the syntax by yourself!
  18. 18. Demo – Finding Duplicate Files* • Source code (link) • Demo Video (link) *Courtesy to “Wicked Cool Perl Scripts” by Steve Oualline. For more examples please read this book.
  19. 19. Somebody said Perl sucks? • Ugly • Illegible syntax • Hard to maintain • Lack of method signatures • Not a real OOPL For more into refer to What's wrong with Perl?
  20. 20. When to use Perl for us? • Processing test results • Installing recurrent builds • Performing repetitive test steps • Integrating different tests • ..and so on and so forth
  21. 21. Want more fun with Perl?
  22. 22. Online tutorials • perlintro – http://perldoc.perl.org/perlintro.html • perltut – http://perldoc.perl.org/index-tutorials.html • A quick tutorial in Chinese – http://www.cbi.pku.edu.cn/chinese/documents/perl/index.htm
  23. 23. Books
  24. 24. • Comprehensive Archive Networks • Hosts over 15,400 Perl modules • Has more than 250 mirrors across the world • One-click-install for modules for almost all imaginable tasks
  25. 25. User Communities • PerlMonks: – http://www.perlmonks.org/ • use Perl; – http://use.perl.org/ • Perl Mongers: – http://www.pm.org/ • Perl China – http://bbs.perlchina.org/

×