home menu courses menu schedule menu register  menu contact menu extras menu

Perl Classes

1-800-716-4324

San Francisco Bay Area


Class Info for:

$895 for two full days, 9am-4pm
Held at AcademyX
601 Montgomery St. #409 (map)
San Francisco Bay Area
Sign up for:  
May 29 and 30 | Jun 24 and 25 | Jul 22 and 23 | Aug 19 and 20 | Sep 16 and 17

Intermediate Perl - San Francisco

ActiveState logo This Intermediate Perl class is the second and third day of the five-day Perl training course, but it can be taken independently of the five-day package.

In this class you'll learn new and important programming concepts in Perl. Once you have these extra tools, you'll be able to understand and take advantage of one of the best features of the language: the vast number of pre-written "modules" that accomplish specific tasks like sending email, getting the source code of remote web sites, and (in the advanced class) database integration. In this class we will use ActiveState's distribution of Perl and its Perl code editor.

Command-line Options and the Perl Debugger

There are several options (called "switches") to change the way Perl normally operates when you invoke it on the command line. We'll examine two of these: the "execute" and "debug" switches. The execute switch allows you to immediately run one small line of Perl code without having to create a whole Perl program to test it. The debug switch launches a program that either steps through the code of your program, or waits for you to type Perl commands that it will immediately execute, one at a time.

Arrays (Lists)

Like other languages, Perl has special variable types such as arrays and hashes. Arrays (often called lists) are variables that have one name, but multiple values. Each value in an array corresponds with a number; for example, you could create an array of states numbered from 0 to 49, and the values would include everything from "Alabama" to "Wyoming". This class will show you how to create, manipulate, and output these arrays. You'll also learn about some "built-in" arrays that contain useful values, such as a list of words that were typed on the command line when a perl program is launched (the @ARGV array) and a list of directories where Perl searches for other programs (the @INC array). One important use of arrays is in subroutines, where arguments passed to the subroutine are stored in a special array (@_).

Subroutines and Including Code from Other Files

Typically a Perl program will re-use both code from within a program and from within other files. Subroutines provide the means for this modularity; they are memorized chunks of code that accomplish a discrete task intended to be performed more than once. When executed, subroutines are given a list of arguments to process. This class will show you how create subroutines and how to incorporate other files with subroutines using the require() function.

File Input/Output

Perl makes it easy to read text in from a file and to change the contents of text files. We'll look at a rudimentary phonebook text file that illustrates reading from, appending to, and overwriting text files. You'll see that file i/o also relies on the concepts of arrays, where each line of the file is stored in the list.

Associative Arrays (Hashes)

Associative arrays (also known as "hashes") are also variables that contain more than one value. Instead of being indexed or itemized by numbers, though, they are indexed by words. For example, instead of outputting the name of the 25th state using a list, you could output the state name given the name of its governor. This class will show you how to go through all the keywords in an associative array and output the values associated with each keyword. You'll also learn about the built-in associative array %ENV for environmental variables.

Lexical Scoping

If your script depends on a number of subroutines defined in other perl scripts and modules, you'll need a mechanism to identify which variables belong to which blocks of code. Three lexical scoping operators -- "my", "local", and "our" -- help to insulate blocks of code from accidentally overwriting variables defined in other blocks. Likewise, when running subroutines from a module, you'll need to identify the "namespace" of that module, to distinguish subroutines in that module from those in your main program. This class will show you how to clearly identify the namespace of a module and how to launch subroutines from within it.

Understanding Module Namespaces and their Associated Syntax

Modules are separate files with Perl code that you can use in your scripts to accomplish specific tasks. Since modules are "black boxes" the contents of which are unknown to you, the danger exists that the names of your own subroutines and variables may coincidentally be the same as the ones used in the module. To avoid collisions of this sort, a special syntax is used to identify the "namespace" to which a variable or subroutine belongs. This special syntax involves the use of double colons (::). We'll show you how to properly identify the subroutines you want to run from the module, and how to distinguish them from your own variables and subroutines. We'll take a closer look at the famous CGI.pm module used in the Introduction class to decipher the confusing notation that often seen in lines like "use CGI qw(:standard);" and "use Net::Sendmail;".

Using Modules for Email and HTML/Text Retrieval

Once you've got a clear understanding of module namespaces, we'll introduce you to two new modules: one that connects to a mail server (on Windows or Unix) and sends out an email (the Mail::Sendmail module), and another that connects to remote web sites and retrieves the source HTML or text (the LWP::Simple module).

Prerequisites:

  • Intro to Perl or equivalent previous experience: must be able to write basic Perl scripts


keywords: perl training san francisco bay area (Perl Introduction), perl course san francisco bay area (Perl Advanced)

Newsletter subscribers can win $100 credit!

Home | Course Catalog | Schedule | About Us | Contact Us | Extras | Sitemap | Package Rates | Shopcart