Perl CGI Scripting Introduction

This course will teach students how to harness Perl's potential for processing forms, searching HTML pages and text files, sending e-mail, and more.

After completing this course, students will be able to:

  • Understand Perl Commands and Program Structure
  • Get to Know CGI.pm
  • Use Regular Expressions
  • Read and Write Files
  • Send E-mail
key facts buy online

• code: W171eng
• 2 days
Download outline
Download sample
• Print licence available

Student edition
A4 format
A5 format
Instructor edition
A4 format
A5 format

Target audience

Students should have an excellent working knowledge of HTML gained through prior experience or from an attendance on an advanced level course.

Course content

Introduction Your Files for Class

What is a CGI Script, and What is Perl? What's Special About a cgi-bin Directory?

Perl Syntax print Statements • Identifying the Perl Interpreter • The Content-type Header • Printing HTML Content • Comments • Exercise 1: Building a Simple Web Page in Perl

Interpreting Variables Scalar Variables • Form Variables • Exercise 2: Processing a Form

Working with Scalars Scalars and Arithmetic • Shortcut Operation and Assignment • Autoincrement (++) and Autodecrement (--)

Conditionals Testing Existence of a Variable • Comparing Values • Combining Multiple Conditions • More Than Just if-else • Pessimistic Tests With unless • Exercise 3: Testing Form Values with Conditionals

Pattern Matching Case Sensitivity • Testing Environment for Regular Expressions • Some Common Patterns • Exercise 4: Validating Form Data

Pattern Substitution Remembering Text with Backreferences • Character Translation • Exercise 5: Substitution and Backreferences

Array Variables Creating an Array • Individual Array Elements • Counting Array Elements • Reading One Array into Several Scalars • Adding Array Elements with push • Removing an Array Element with shift • Exercise 6: Using Basic Arrays

More Array Functions Reordering Your Array with sort and reverse • Search Your Array with grep • Change Between Array and Scalar with join and split • Exercise 7: Practicing with Array Functions

Loops Looping with while and until • Looping with for • Looping with foreach • Exercise 8: Looping Through Your Array

Reading from and Writing to Files A Simple Demonstration • What These Scripts Have in Common • Adding Text to a File • Reading Lines from a File • Confirm that the File Opened Properly • Using split to Parse Tab-Delimited Text Files • Exercise 9: Writing to a Text File • Exercise 10: Searching in a Text File

Listing Files in a Directory Filtering File Names with grep

Introducing Subroutines How to Write Subroutines • Exercise 11: Building and Calling Subroutines

Making Your Subroutine More Reusable Passing Variables to a Subroutine • Returning Results from a Subroutine • Variable Scope with my and local • Exercise 12: Passing Variables to and from Subroutines

Hash Variables Looping Through a Hash • Other Hash Manipulations • Environment Variables: a Ready-Made Hash • Another Useful Loop: All Form Variables • Exercise 13: Practicing with Hashes

Sending Email The Mail::Mailer Module • Exercise 14: Sending an Email Message

Appendix A: Glossary

Appendix B: Special Characters

Appendix C: Special Characters for Pattern Matching

Appendix D: Recommended Resources


About Courseware Company :: Instructor-led training courseware :: Self-study solutions :: Buy online today

A gtslearning business division :: gtslearning CompTIA learning solutions ::Contact us :: Site map
© gtslearning, 2008. All rights reserved. Ownership of all trademarks and service marks is observed and respected.