Overview of Perl
The Perl Programming course is a complete sequence that explains the Perl programming language, from basic till advanced syntax. The course covers widespread of people like programmers, web authors, developers, operators and system administrators. Defines how to use Perl programming language to write fast yet powerful scripts to issue Perl commands and take advantage of Perl’s system administration capabilitie.
Duration
5 Days
Prerequisite for Perl
Knowledge of any programming language (C / C++ / Shell Scripting)
Course Outline for Perl
Day 1
Brief History of Perl
- Executing Perl commands at the command line
- White Spaces
- Semicolons
- Commenting lines
- Special Characters (new line, tab, etc)
- Quoting strings
- Cross Platform Perl Scripts
- Working with variables
- Scalars
- Arrays
- Hashes – Associative Arrays
- Operators
Arithmetic Operators
Assignment Operators
Logical Operators
String Operators
Relational Operators
File Test Operators
I/O Statements
Reading from keyboard
Writing to Screen
Control structures
Conditionals
if
unless
Loops
while
- while
until
- until
Loop Control
last
next
redo
LAB Exercise: User of Array and Function, Hash and Functions, list, join, split, Interpolation, q/, qq/, qw/, /u, /l etc.
Day 2
Global Special Variables
- Global Special Arrays & Hashes
- Global Special File Handles
- Global Special Constants
Special Variables
File Handling
- Opening the file
- read mode
- write mode
- append mode
- read-write mode
- Reading from the file
- Writing to the file
- Closing the file
Simple Perl functions
- Extracting characters from a string
- Finding the index of a character in the string Extracting a substring from a string Array Functions
- Inserting elements in an array at specified position
Lab Exercise:
- Write a Copy command Perl Program. Use of <> and File handling
- Use of File Test command
• Use of Global Special Variable
Day 3
Regular Expressions
- Basic Regular Expressions
- Advanced Regular Expressions
- Scope of the variable
- Dynamic Scope
- Lexical Scope
References
- Array References
- Hash References
- Constructing multidimensional arrays
- Subroutines
- parameter processing
- Call By Reference
- Call By Value
- Packages and Modules
- Defining a Module’s interface
- Making Variables Private to a module
- Determining the Caller’s Package
- Automating Module Clean-up
- Preparing a Module for Distribution
- Speeding Module Loading with SelfLoader
- Speeding Up Module Loading with AutoLoader
- Overriding Built-in Functions
- Reporting Errors and Warnings Like Built-Ins
- Referring to Packages Indirectly
- Building and Installing a CPAN Module
Lab Exercise:
- Write a Subroutine for total of any Sequence
- Write a Subroutine using @ARGV
- Write a Subroutine using shift (parameter passing).
- Build Packages using Package Variables (our )
- Use of existing packages in Perl
Day 4
Object Oriented Perl
- Constructing an object
- Destroying an Object
- Managing Instance Data
- Managing Class Data
- Using Classes as Structs
- Cloning Objects
- Calling Methods Indirectly
- Determining Subclass Membership
- Writing an Inheritance Class
- Accessing Overriden Methods
- Generating Attribute Methods
- Using AUTOLOAD
- Coping with Circular Data Structures
- Overloading Operators
- Creating Magic Variables with tie
- Working with Databases
- DBI Module
- Connecting to Database
- Solving the Data Inheritance Problem
- Disconnecting from the database
- Create a table
- Insert a record in the table
- Query the table
- Update a record
- Delete a record
- Drop a table
Lab Exercise:
- Create a Person class.
- Write a Class Method and Object Method
- Access Class-Method and Object-Method using New object
- Inherit Person class in Employee Class
- Add new method in Employee class
- Override method of parent class in Employee class
- Create a Database in Mysql.
- Create a Table using perl DBI
- Insert single record using Perl DBI
- Insert Multiple record using placeholder (?).
- Update and Select records etc.
Day 5
Introduction to MQSeries
- Message queue
- MQSeries client
- MQSeries messages
- MQSeries objects use CGI
- Configure Apache Server for CGI-scripting
- Create CGI form
- Use of get, put, post method.
- Perl CGI & DBI application.
The Perl Debugger
- Entering and Exiting the Perl Debugger
- Entering the Debugger
- Exiting the Debugger
- List in Stepping Through Programs
- Displaying Variable Values
- Breakpoints
- Tracing Program Execution
- Line Actions
- Other Debugging Commands
Lab Exercise:
- MQSeries CPAN modules
- Writing your own MQSeries module
- package MQSeries: Command: Base Sample Example
- package MQSeries: Command: Request
- package MQSeries: Command: Response;