Download presentation
Presentation is loading. Please wait.
Published bySpencer Barrett Modified over 9 years ago
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: n is for people who know some other programming language and n should enable you to manage the network, write reports, and write CGI scripts using Perl.
3
Course Outline n About Perl n Installing Perl n Writing Perl n Debugging Perl n Extending Perl n Applying Perl Using Regular Expressions n Applying Perl for CGI
4
About Perl n Larry Wall n If you were to write a language that anybody could use, what would be some characteristics of that language?
5
Installing Perl n Normally, from: www.activestate.com n For a limited time from www.cascss.unt.edu/~tim/perl/ n After installing Perl, how do you get help? n Your personal task before next class: Install Perl on your computer at work and/or home.
6
Writing Perl n Comments n Statements n Programs n Data Types n Data Type Operators n Flow Control n File Operators
7
Comments n First line comments, like: #!/usr/bin/perl n Other Comments n Example: www.cascss.unt.edu/~tim/perl/com ment.pl
8
Statements n Every part of a Perl script (except comments) consists of a statement. n Contain one or more function calls, L/Rvalues, and flow controls. n End with a semicolon (;). n Perl ignores all white space. n Example: www.cascss.unt.edu/~tim/perl/stat ement.pl
9
Programs n Running from the command line. n Running from a file. n Example: www.cascss.unt.edu/~tim/perl/birth.pl
10
Data Types n Scalars: www.cascss.unt.edu/~tim/perl/scal ar.pl n Arrays: www.cascss.unt.edu/~tim/perl/arra y.pl n Associative arrays: www.cascss.unt.edu/~tim/perl/ass ocarray.pl n The $_ and @_ variables.
11
Data Types Comparators n To compare characters: eq, ne, lt, gt, le, ge n To compare numbers: ==, !=,, = n Mnemonic: Always use characters to compare characters. n More: www.perl.com/CPAN- local/doc/manual/html/pod/perlop.h tml
12
Flow Control n If/else: www.cas.unt.edu/~tim/perl/if.pl n For: www.cas.unt.edu/~tim/perl/for.pl n Foreach: www.cas.unt.edu/~tim/perl/foreach.pl n Subroutines: www.cas.unt.edu/~tim/perl/subrouti ne.pl
13
File Operators n Special <> notation for the identifier. n Useful functions: open, close n Uses redirection symbols: >, >, <<, | n Example: www.cas.unt.edu/~tim/perl/file.pl
14
Debugging Perl n What is a debugger? n What is the best debugger? n Perl’s -d switch.
15
Extending Perl n Functions: www.perl.com/CPAN- local/doc/manual/html/pod/perlfunc.html n Modules: www.cpan.org/ n Getting help with modules. n Using Modules.
16
Account Builder n Use flow control and subroutines and good coding style to: u Read in a file of names (like “Tim Christian”). u Create 8 character IDs based on those names until ID@unt.edu does not exist. n Hint: You might want to check out the length() and substr() functions.
17
Next Class n Bring your account builder solution to class n Regular expressions n Applying regular expressions in Perl
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.