Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Introduction to Ruby.
Advertisements

Arrays A list is an ordered collection of scalars. An array is a variable that holds a list. Arrays have a minimum size of 0 and a very large maximum size.
AN INTRODUCTION TO PL/SQL Mehdi Azarmi 1. Introduction PL/SQL is Oracle's procedural language extension to SQL, the non-procedural relational database.
Computer Programming for Biologists Class 9 Dec 4 th, 2014 Karsten Hokamp
Lecture-5 Though SQL is the natural language of the DBA, it suffers from various inherent disadvantages, when used as a conventional programming language.
CS311 – Today's class Perl – Practical Extraction Report Language. Assignment 2 discussion Lecture 071CS Operating Systems I.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Linux+ Guide to Linux Certification, Second Edition
Practical Extraction & Report Language Picture taken from
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
Scripting Languages Perl Chapter #4 Subroutines. Writing your own Functions Functions is a programming language serve tow purposes: –They allow you to.
Introduction to PL/SQL
Guide To UNIX Using Linux Third Edition
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
2.1 Lists and Arrays Summary of 1 st lesson Single quoted and double quoted strings Backslash ( \ ) – the escape character: \t \n Operators:
2ex.1 Lists and Arrays. 2ex.2 Comments on exercises Always run your script with “ perl -w ” and take care of all warnings  submitted scripts should not.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 25 – Perl and CGI (Common Gateway Interface) Outline 25.1 Introduction 25.2 Perl 25.3 String Processing.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 35 – Python Outline 35.1 Introduction First Python Program Python Keywords 35.2 Basic.
Introduction to Shell Script Programming
Perl Tutorial Presented by Pradeepsunder. Why PERL ???  Practical extraction and report language  Similar to shell script but lot easier and more powerful.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
An Introduction to Unix Shell Scripting
Chap 3 – PHP Quick Start COMP RL Professor Mattos.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Shell Script Programming. 2 Using UNIX Shell Scripts Unlike high-level language programs, shell scripts do not have to be converted into machine language.
4 1 Array and Hash Variables CGI/Perl Programming By Diane Zak.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification Chapter Eight Working with the BASH Shell.
Meet Perl, Part 2 Flow of Control and I/O. Perl Statements Lots of different ways to write similar statements –Can make your code look more like natural.
Chapter 2 Functions and Control Structures PHP Programming with MySQL 2 nd Edition.
Sed, awk, & perl CS 2204 Class meeting 13 *Notes by Mir Farooq Ali and other members of the CS faculty at Virginia Tech. Copyright 2003.
Chapter 9: Perl Programming Practical Extraction and Report Language Some materials are taken from Sams Teach Yourself Perl 5 in 21 Days, Second Edition.
7 1 User-Defined Functions CGI/Perl Programming By Diane Zak.
Chapter 15 Introduction to PL/SQL. Chapter Objectives  Explain the benefits of using PL/SQL blocks versus several SQL statements  Identify the sections.
Guide to Oracle 10g ITBIS373 Database Development Lecture 4a - Chapter 4: Using SQL Queries to Insert, Update, Delete, and View Data.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Prof. Alfred J Bird, Ph.D., NBCT Office – McCormick 3rd floor 607 Office Hours – Tuesday and.
Computer Programming for Biologists Class 3 Nov 13 th, 2014 Karsten Hokamp
5 1 Data Files CGI/Perl Programming By Diane Zak.
JavaScript, Fourth Edition
Perl Tutorial. Why PERL ??? Practical extraction and report language Similar to shell script but lot easier and more powerful Easy availablity All details.
CPTG286K Programming - Perl Chapter 4: Control Structures.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
Topic 4:Subroutines CSE2395/CSE3395 Perl Programming Learning Perl 3rd edition chapter 4, pages 56-72, Programming Perl 3rd edition pages 80-83,
Chapter Twelve sed, awk & perl1 System Programming sed, awk & perl.
Chapter Six Introduction to Shell Script Programming.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Department of Electrical and Computer Engineering Introduction to Perl By Hector M Lugo-Cordero August 26, 2008.
Introduction to Perl. What is Perl Perl is an interpreted language. This means you run it through an interpreter, not a compiler. Similar to shell script.
 2001 Prentice Hall, Inc. All rights reserved. Chapter 7 - Introduction to Common Gateway Interface (CGI) Outline 7.1Introduction 7.2A Simple HTTP Transaction.
Perl Variables: Array Web Programming1. Review: Perl Variables Scalar ► e.g. $var1 = “Mary”; $var2= 1; ► holds number, character, string Array ► e.g.
Week Four Agenda Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines.
Linux+ Guide to Linux Certification, Second Edition
 History  Ease of use  Portability  Standard  Security & Privacy  User support  Application &Popularity Today  Ten Most Popular Programming Languages.
PERL By C. Shing ITEC Dept Radford University. Objectives Understand the history Understand constants and variables Understand operators Understand control.
Programming Perl in UNIX Course Number : CIT 370 Week 2 Prof. Daniel Chen.
2000 Copyrights, Danielle S. Lahmani Foreach example = ( 3, 5, 7, 9) foreach $one ) { $one*=3; } is now (9,15,21,27)
Dept. of Animal Breeding and Genetics Programming basics & introduction to PERL Mats Pettersson.
CSC 4630 Perl 3 adapted from R. E. Beck. Problem But we worked on it first: Input: Read from a text file named in a command line argument Output: List.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
Linux Administration Working with the BASH Shell.
Perl Variables: Array Web Programming.
Presentation transcript:

Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist

Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Lesson 1: Introduction to Perl

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Objectives Describe the benefits of Perl Explain the role of the Perl interpreter Identify the characteristics of Perl’s basic syntax Describe the use of the print function Create and execute a simple Perl script Define scalar variables Use scalar variables to manipulate numerical and string data Use expression operators Retrieve data from STDIN

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Practical Extracting and Reporting Language Why use Perl? –Innate flexibility –Simple syntax –Relaxed compiler instructions –Free

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Getting Started with Perl The shebang line Creating a simple Perl script

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Scalar and Numerical Variables Assignment Expressions

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved String Variables Second type of scalar variable The print function

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Retrieving Data from STDIN The chomp() function

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Summary Describe the benefits of Perl Explain the role of the Perl interpreter Identify the characteristics of Perl’s basic syntax Describe the use of the print function Create and execute a simple Perl script Define scalar variables Use scalar variables to manipulate numerical and string data Use expression operators Retrieve data from STDIN

Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Lesson 2: Flow Control in Perl

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Objectives Evaluate Boolean expressions Construct an if statement Discuss else and elsif branches Construct a while loop Construct a do {} while loop Construct a for loop Use loop labels Describe the I/O redirection paradigm

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Boolean Expressions in Perl Numeric Boolean expressions String Boolean expressions Logical operators

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved The if Statement The else branch The elsif branch

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved The while Statement Second type of control structure Defines a block of code that will be executed repeatedly as long as some Boolean expression evaluates as true

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved The do { } while Statement Similar to the while loop except that the condition is not evaluated until the code block has already been executed once

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved The for Statement Includes three expressions separated by semicolons Incorporates facilities for initializing a counter and incrementing it on each turn through the code block

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Loop-Control Commands last next redo

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved I/O Redirection Many Perl scripts use I/O redirection in place of more complicated file-handling subroutines

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Summary Evaluate Boolean expressions Construct an if statement Discuss else and elsif branches Construct a while loop Construct a do {} while loop Construct a for loop Use loop labels Describe the I/O redirection paradigm

Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Lesson 3: Regular Expressions in Perl

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Objectives Define regular expressions Perform pattern matching Define and use metacharacters Explain character classes Define quantifiers and assertions Perform substitution Use the binding operator

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Introduction to Regular Expressions Pattern binding operators Escape sequences and metacharacters

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Character Classes Indicate a list of characters that one element in a string will match

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Pattern Matching and Substitution Back references

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Summary Define regular expressions Perform pattern matching Define and use metacharacters Explain character classes Define quantifiers and assertions Perform substitution Use the binding operator

Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Lesson 4: Arrays in Perl

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Objectives Describe the purpose of arrays Define arrays using lists Access array elements Use the sort function to sort an array alphabetically Use a foreach loop to traverse an array Use the push and pop functions Use the shift and unshift functions Use the split and join functions

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Introduction to Perl Arrays Initializing arrays Accessing array elements

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved The sort Function Accepts an array as an argument, alphabetizes the elements within the array, and returns the resultant array

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved The foreach Statement A special control structure designed to iterate through an array or list

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved The push and pop Functions The push function adds values to the top of a stack The pop function removes values from a stack

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved The shift and unshift Functions The unshift function adds a value to the front of an array and shifts the rest of the array by one The shift function removes values from an array Using an array as a queue

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved The split and join Functions The split function accepts two arguments, a regular expression and a string The join function accepts a list of values and combines them into a single string

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Summary Describe the purpose of arrays Define arrays using lists Access array elements Use the sort function to sort an array alphabetically Use a foreach loop to traverse an array Use the push and pop functions Use the shift and unshift functions Use the split and join functions

Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Lesson 5: Hashes in Perl

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Objectives Describe the purpose of hashes Define hashes using lists Access hash elements Use the delete function Use the keys function Use the values function Use the each function Use the reverse function

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Introduction to Perl Hashes Hashes are collections of scalar values that can be accessed individually Hash elements are accessed using an arbitrary scalar value, called a key Also known as associative arrays

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Adding and Deleting Hash Elements The delete function The keys function The values function The each function The reverse function

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Summary Describe the purpose of hashes Define hashes using lists Access hash elements Use the delete function Use the keys function Use the values function Use the each function Use the reverse function

Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Lesson 6: Subroutines in Perl

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Objectives Define and use a subroutine Call subroutines directly and indirectly Pass values to a subroutine Return a value from a subroutine Explain variable scope Pass references to a subroutine

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Introduction to Perl Subroutines Defining subroutines Calling subroutines Passing arguments Returning values The sort function and subroutines

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Variable Scope Variables can be created within subroutines that are private (specific) to just that subroutine using the my operator –The my operator takes a scalar, array, or hash name and instantiates local versions inside a subroutine

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved References Creating and referencing anonymous arrays Creating and referencing anonymous hashes Passing references to subroutines

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Summary Define and use a subroutine Call subroutines directly and indirectly Pass values to a subroutine Return a value from a subroutine Explain variable scope Pass references to a subroutine

Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Lesson 7: File Input and Output

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Objectives Define and use filehandles Obtain a filehandle using the open function Output data to a file Close a file using the close function Open a file for reading Use the stat and lstat functions to obtain information about a file

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl File Input and Output What is a filehandle? The open function Outputting data to a file Opening files for reading Other file-related functions Determining information about files The stat and lstat functions

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Summary Define and use filehandles Obtain a filehandle using the open function Output data to a file Close a file using the close function Open a file for reading Use the stat and lstat functions to obtain information about a file

Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Lesson 8: Environment Variables and Command Line Arguments

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Objectives Access and use environment variables Use command line arguments Define options when handling command line arguments

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Environment Variables What are environment variables? –Shells

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Command Line Arguments Arguments entered at the command line can be used in Perl programs

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Summary Access and use environment variables Use command line arguments Define options when handling command line arguments

Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Lesson 9: Packages and Modules in Perl

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Objectives Describe the purpose of packages Use the package keyword Use BEGIN and END blocks Describe the purpose of modules Create a module to facilitate code reuse Incorporate a module into your Perl scripts using the use and require statements Use the Exporter module

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Using Packages in Perl Namespace The package keyword Package symbol tables

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved BEGIN and END Blocks Special blocks of code defined within a package

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Using Modules in Perl Specially designed Perl scripts that package functionality for reuse by other Perl scripts

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved The use and require Statements The require statement takes a single argument (the name of the module to include) The use statement adds symbols directly to the including package’s symbol table

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Summary Describe the purpose of packages Use the package keyword Use BEGIN and END blocks Describe the purpose of modules Create a module to facilitate code reuse Incorporate a module into your Perl scripts using the use and require statements Use the Exporter module

Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Lesson 10: Object-Oriented Perl

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Objectives Describe the purpose of objects Define objects for use in your Perl scripts Access object data Define and use object methods Use inheritance to expand the functionality of a class

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Introduction to Object-Oriented Perl Creating objects Object data Object methods

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved array Destructor methods

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Summary Describe the purpose of objects Define objects for use in your Perl scripts Access object data Define and use object methods Use inheritance to expand the functionality of a class

Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Lesson 11: Database Connectivity and Perl

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Objectives Define database programming Explain the benefits of using a database Define and use the Database Interface Module (DBI) Define and use the Database Driver Module (DBD) Open a database connection Close a connection to a database Query a database Define and use the Structured Query Language (SQL) Return records from a database Insert records into a database

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Introduction to Database Connectivity Database programming Database Interface Module Database Driver Module

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Interacting with Databases 1. Connect to the database 2. Query the database 3. Display the results 4. Close the connection

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Connecting to Databases The connect method

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Structured Query Language Data Definition Language –CREATE –DROP Data Query Language Data Manipulation Language –INSERT –DELETE –UPDATE

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Quoting Operators Perl includes quoting operators that can be used instead of single or double quotation marks

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Summary Define database programming Explain the benefits of using a database Define and use the Database Interface Module (DBI) Define and use the Database Driver Module (DBD) Open a database connection Close a connection to a database Query a database Define and use the Structured Query Language (SQL) Return records from a database Insert records into a database

Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Lesson 12: Debugging Perl Programs

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Objectives Debug Perl programs Use the –w switch Use the strict module Trace the execution of a Perl script Issue commands to the Perl debugger Design Perl scripts to minimize bugs

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Introduction to Debugging Perl Scripts Using the print command Using the –w switch Using the strict module

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved The Perl Debugger Traps and fixes errors in a Perl script An interactive Perl environment wherein the user is prompted for debugger commands

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Writing Bug-Free Perl Code Preventing errors Common Perl errors

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Summary Debug Perl programs Use the –w switch Use the strict module Trace the execution of a Perl script Issue commands to the Perl debugger Design Perl scripts to minimize bugs

Perl Specialist Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist Introduction to Perl Flow Control in Perl Regular Expressions in Perl Arrays in Perl Hashes in Perl Subroutines in Perl File Input and Output Environment Variables and Command Line Arguments Packages and Modules in Perl Object-Oriented Perl Database Connectivity and Perl Debugging Perl Programs