Perl 101: Introduction to Perl Programming
About this Course
A comprehensive introduction to the Perl programming language. You will learn how to develop powerful programs quickly to solve a variety of real-world problems. The class consists of twelve chapters, each one exploring a different area of the Perl language. We will spend about 25% of the time in lecture, and the remaining 75% of the time doing hands-on programming exercises. The programming exercises have been specially designed to help you learn and apply the new concepts from each chapter.
You Will Learn How To
- Use Perl effectively
- Write scripts using scalar, array, and hash variables
- Implement regular expressions, subroutines, and other key language features.
- Use good programming techniques to develop Perl programs that are easy to update and maintain
Who should attend?
- Linux, Unix, and Windows system administrators
- Network engineers
- Quality assurance engineers
- Hardware engineers
- Web developers
- Anyone who needs to write Perl scripts
Prerequisites:
Some programming experience is strongly recommended, in a language such as C, C++, Java, ECMAScript/Javascript, or Linux/Unix-shell-scripting. The course does not assume any prior Perl knowledge. However, it assumes you can do basic text editing and understand fundamentals of writing scripts (or programs), e.g., concepts of variables, arrays etc.
Next Step:
Perl 201: Advanced Concepts in Perl Programming
Programming Environment:
Perl runs on any modern operating system, and our lab exercises are operating-system-independent. You may bring a laptop running Windows, Mac, or Linux for your lab exercises, or use the workstation we provide (typically running Windows). Any text editor may be used to edit Perl code for the lab exercises.
Course Materials:
All classes include printed course materials and a CD-ROM with course materials and lab solutions. A workstation is available for you to do your lab exercises, but you are welcome to bring your own laptop and use it instead.
Course Outline:
- The Philosophy of Perl
History of Perl; The name "Perl"; Perl culture; Syntax; How Perl is like other languages; How Perl is unique; Types of Expressions & Variables; Hello World; Basic Input & Output
- Scalars
Weakly typed language; Scalar variables; Literal values; Quotes in Perl strings; Operators; Numeric and String Operators; Precedence; Context
- Boolean Operators
Numeric Comparison; String Comparison; Definedness; True or False values of scalars; And, Or, Not operators; Short-circuit behavior; Ternary operator
- Regular Expressions
What is a Regular Expression?; Using a regular expression in Perl; Regular expression syntax; Metacharacters; Character classes; Using the backslash; Alternation & Grouping; Modifier suffixes; Substitution; Alternative delimiters
- Loops & Conditionals
Conditional: if, else, elsif; Basic loop: while, until; C-style loop: for; List iteration: foreach; Bottom-testing: do..while; Suffix forms of flow control; Jumping around in loops: next, last, redo; Reading from a filehandle
- Debugging & Best Practices
Perl command-line options for debugging; Online documentation; Debugging techniques; Declaring variables and using "strict"; Common mistakes; Learning from Perl errors and warnings; Style suggestions
- Scalar functions
Formatting strings: printf, sprintf; Converting text to upper/lower case; String length; Random numbers
- Lists & Arrays
What is a list?; Assigning to a list of variables; Arrays; Array elements; Quoted words; Lists of sequential values; Splitting strings; Joining lists into strings; Sorting lists; Reversing a list; Printing arrays; Array functions; Single-element lists
- Hashes
What is a hash?; Hash syntax; Hash elements; Accessing hash as a list; Autovivification; Hash functions; Hash loop idioms; Truth vs. Defined vs. Exists
- Accessing Files & Directories
Opening files; Filehandles; Reading from files; Context: list vs. scalar; Read, write, and append modes; Perl program arguments: @ARGV; The ARGV filehandle or "diamond operator"; Command-line loops: -n and -p; Directory handles; File Test Operators
- Subroutines
What is a subroutine?; Subroutine syntax; Passing multiple values; Accessing subroutine arguments; Returning single values; Returning list of values; Context and return values
- Perl Modules
What is a Perl Module?; Module taxonomy; Example modules; Module documentation; Module hierarchical names; Search path: @INC; Finding and installing modules
Class Format
This class is available as a one-day seminar, open to all for enrollment. For more information, see the Seminars page. All-Day courses are held from 9:00 AM to approximately 6:00 PM with a one-hour break for lunch from noon to 1:00 PM. Light snacks and beverages are included; lunch is not.
Upcoming dates for this class:
On-Site Training
This class is also available as an on-site class. See our On-Site Training page for more information.
Course details subject to change without notice. All classes are conducted in English.
Last updated: 02/12/2010
Copyright © 1995-2008 William R. Ward dba Bay View Training. All Rights Reserved. “Bay View Training”, “Bay View Consulting Services”, “Bay View Software”, the sailboat logo, and the domain name “bayview.com” are trademarks and/or service marks of William R. Ward dba Bay View Training. For more information, contact training@bayview.com
