1 / 17

Introducing System Managers to Win32 Perl Programming

Introducing System Managers to Win32 Perl Programming. Tim Christian (tim@unt.edu) College of Arts and Sciences Computing Support Services. Welcome! This course:. is for people who know some other programming language and

neci
Download Presentation

Introducing System Managers to Win32 Perl Programming

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. Introducing System Managers to Win32 Perl Programming Tim Christian (tim@unt.edu) College of Arts and Sciences Computing Support Services

  2. Welcome! This course: • is for people who know some other programming language and • should enable you to manage the network, write reports, and write CGI scripts using Perl.

  3. Course Outline • About Perl • Installing Perl • Writing Perl • Debugging Perl • Extending Perl • Applying Perl Using Regular Expressions • Applying Perl for CGI

  4. About Perl • Larry Wall • If you were to write a language that anybody could use, what would be some characteristics of that language?

  5. Installing Perl • Normally, from: www.activestate.com • For a limited time from www.cascss.unt.edu/~tim/perl/ • After installing Perl, how do you get help? • Your personal task before next class: Install Perl on your computer at work and/or home.

  6. Writing Perl • Comments • Statements • Programs • Data Types • Data Type Operators • Flow Control • File Operators

  7. Comments • First line comments, like: #!/usr/bin/perl • Other Comments • Example: www.cascss.unt.edu/~tim/perl/comment.pl

  8. Statements • Every part of a Perl script (except comments) consists of a statement. • Contain one or more function calls, L/Rvalues, and flow controls. • End with a semicolon (;). • Perl ignores all white space. • Example: www.cascss.unt.edu/~tim/perl/statement.pl

  9. Programs • Running from the command line. • Running from a file. • Example: www.cascss.unt.edu/~tim/perl/birth.pl

  10. Data Types • Scalars: www.cascss.unt.edu/~tim/perl/scalar.pl • Arrays: www.cascss.unt.edu/~tim/perl/array.pl • Associative arrays: www.cascss.unt.edu/~tim/perl/assocarray.pl • The $_ and @_ variables.

  11. Data Types Comparators • To compare characters: eq, ne, lt, gt, le, ge • To compare numbers: ==, !=, <. >, <=, >= • Mnemonic: Always use characters to compare characters. • More: www.perl.com/CPAN-local/doc/manual/html/pod/perlop.html

  12. Flow Control • If/else: www.cas.unt.edu/~tim/perl/if.pl • For: www.cas.unt.edu/~tim/perl/for.pl • Foreach: www.cas.unt.edu/~tim/perl/foreach.pl • Subroutines: www.cas.unt.edu/~tim/perl/subroutine.pl

  13. File Operators • Special <> notation for the identifier. • Useful functions: open, close • Uses redirection symbols: >, <, >>, <<, | • Example: www.cas.unt.edu/~tim/perl/file.pl

  14. Debugging Perl • What is a debugger? • What is the best debugger? • Perl’s -d switch.

  15. Extending Perl • Functions: www.perl.com/CPAN-local/doc/manual/html/pod/perlfunc.html • Modules: www.cpan.org/ • Getting help with modules. • Using Modules.

  16. Account Builder • Use flow control and subroutines and good coding style to: • Read in a file of names (like “Tim Christian”). • Create 8 character IDs based on those names until ID@unt.edu does not exist. • Hint: You might want to check out the length() and substr() functions.

  17. Next Class • Bring your account builder solution to class • Regular expressions • Applying regular expressions in Perl

More Related