1 / 17

Computer Systems 201

Computer Systems 201. Contacts. Lecturer: Alison Smith Email: alison.smith@curtin.edu.au Office: 204.522 Phone: 9266 7606 The easiest way is to email for an appointment. Introduction to Perl. What is Perl. “Practical Extraction and Report Language” Created by Larry Wall in mid 1980’s

adin
Download Presentation

Computer Systems 201

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Systems 201

  2. Contacts Lecturer: Alison Smith Email: alison.smith@curtin.edu.au Office: 204.522 Phone: 9266 7606 The easiest way is to email for an appointment.

  3. Introduction to Perl

  4. What is Perl • “Practical Extraction and Report Language” • Created by Larry Wall in mid 1980’s • Intended to fill gap between high and low level programming.

  5. A Brief History • Larry had a lot of text files • He needed to produce a report • Currently available tools were not powerful enough • Required the speed of shell programming with the power of other high level tools

  6. Perl Is: • Easy to use - once you know how! • Nearly Unlimited • Mostly Fast • Potentially Ugly • High Level Language

  7. What is Perl Good for? • Perl is good for: • Working with text • “quick and dirty” tasks • Web / HTML and CGI Programming • Perl is not good for • Hiding your code

  8. How do I get Perl? • Open Source License • Runs on anything “Unix” • Macs • Windows • Windows Perl • Cygwin • CPAN

  9. “your favorite text editor” • VI • GVIM • Emacs • Windows Text Editor • DO NOT USE A WORD PROCESSOR!

  10. Hello World #!/usr/bin/perl # My first perl program print “Hello World!\n”;

  11. Steps to Running a Program • Create the program with your text editor • Run chmod a+x my_program (only need to perform the chmod once) • ./my_program

  12. What? No compile? • Perl is (usually) an interpreted language • Source is in plain text - no obfuscation • Can compile when necessary

  13. Don’t make life hard! • Steep Learning Curve • Shortcuts • “Write only” perl

  14. Good Form • Perl will interpret your code, good or bad! • Use indents • Use comments # this is a comment • Use white space if necessary

  15. Obfuscated Perl http://perl.plover.com/obfuscated/bestever.pl

  16. Obfuscated Perl Result

  17. Next Week: • Perl Variables • Basic I/O • "If" and "while" statements

More Related