View Public Classes








Verilog for Experienced VHDL Designers


























Unix Introduction












 


Perl in PDF


Perl
3 days
50% Lecture/50% Lab
Basic Level

Overview
The Practical Extraction Report Language (Perl) is a popular and portable scripting language used by anyone who needs to extract and manipulate data coming from text files, log files, databases, pipes etc. Perl is extremely powerful and fast, but easier to learn than languages like C and Java. The student will be able to produce working and meaningful Perl programs upon completion of this course.

Benefits
Upon completion of this course, students will be able to:
  • read, write and customize Perl scripts
  • use Perl data types: scalars, arrays, and hashes
  • use Perl operators to test and manipulate strings and numbers
  • use programming constructs such as loops and decision making constructs
  • use the power of regular expressions for extracting selected patterns in text
  • open, close and test files and pipes
  • modularize programs with subroutines
  • debug Perl scripts

Intended Audience
This course is recommended for people with a basic programming background who need to gain a working understanding of Perl for extracting and manipulating data.

Prerequisites
Students need to be familiar with the basics of programming and the use of a text editor. Although Perl can run on a number of operating systems, the course is normally taught in a UNIX/Linux or Windows environment.

Suggested Follow-On Course:
Advanced Perl
Training Approach
This is an intensive, interactive course, which is approximately 50% lecture and 50% lab. Questions are highly encouraged. On the final day, students are given access to a zipped file containing all of the solutions to the labs and the examples used throughout the notebook.

Course Outline

Day One

Module 1-- Perl Syntax
  • What is Perl?
  • Perl at the command line
  • Versions of Perl
  • Where to find Perl
  • What is CPAN?
  • Perl Documentation
  • Basic structure of a Perl script
  • Printing functions
  • Literals -- Numbers and Strings
  • Quoting rules
  • Here Documents

Lab Exercise 1

Module 2 -- Data Types
  • What are Perl variables? (Types, Naming conventions, and Scope)
  • Scalars (Assignment, $_scalar)
  • Arrays (Simple lists, multidimensional lists, assignment)
    • Some Array Functions (pop, push, shift, unshift, split, join, reverse)
  • Associative Arrays/Hashes (Assignment, extracting keys and values)
    • Some Hash Functions (keys, values, each)
  • Reading from STDIN

Lab Exercise 2

Day Two

Module 3 -- Operators
  • What are operators?
    • Precedence and associativity
    • String and arithmetic operators
    • Assignment operators
    • Relational, equality and logical operators
    • Autoincrement and autodecrement operators
    • Bitwise operators
    • Conditional operator
    • Range operator
  • Random Numbers

Lab Exercise 3

Module 4 -- Conditions and Loops
  • Conditional Statements
    • if
    • if/else
    • if/elsif
  • Loops
    • Looping Constructs
      • while
      • until
      • for
      • foreach
    • Loop Control
      • labels
      • redo, next and last

Lab Exercise 4

Module 5 -- Regular Expressions
  • What is a Regular Expression?
  • Simple Statements and Modifiers
  • Pattern Matching
    • The match operator
    • The substitution operator
  • Regular Expression
    • Metacharacters
    • Anchors
    • The Dot
    • Character Sets
    • Metasymbols
    • Greedy Quantifiers
    • Alternation
    • Grouping
    • Capturing
    • Repeating
Day Three

Module 5 -- (continued)
  • Regular Expression
    • Metacharacters

Lab Exercise 5a

  • Translation -- the tr function
  • Pattern Matching Operators

Lab Exercise 5b

Module 6 -- User-defined Filehandles
  • What is a Filehandle?
    • The die function and STDERR
    • Opening files for reading
    • Closing files
    • Closing files for writing
    • Opening files for appending

Lab Exercise 6a

  • Pipes
    • Output filters
    • Input filters
  • File Positions
    • The eof function
    • The seek function
    • The tell function
    • Open for reading and writing
  • File Testing

Lab Exercise 6b

Module 7 -- Subroutines
  • What are Subroutines
  • Defining and Calling subroutines
  • Forward Reference
    • Passing by Reference
    • Local variables and the my functions
    • Passing by Value
    • The return statement

Lab Exercise 7



  For more information, contact:
Tom Wille
TM Associates, Inc.
14420 S. Kelmsley Dr.
Oregon City, OR 97045
503-656-4457
503-656-4775 fax

tw@tm-associates.com