lecture in color

Basic Perl (PP Chapter 1)

Perl Strengths

Advantages:

Disadvantages

Finding out more

Features

The simplest perl program

#! /var/local/couch/bin/perl
print "Hello\n"; 

Our Perl Environment

PERL Variables

Array and associative array caveats

Perl Namespaces

Scalars

Arithmetic operators (scalars)

String Operators (scalars)

Mixing operations

Logic and Scalars

String Construction

Example of strings

Arrays

Array constants

Common array operations

Converting between arrays and strings

Example of split and join

Example: power of interfacing

Example: violate couch's privacy

Contextual execution

Example of contextual execution and arrays

Control flow

A Perl Cliche

All equivalent

All equivalent

C-like iteration

Example of if and while in action

New handling for aggregates

Implicit variables

Reading input

Implicit file I/o

Writing output

Files

Predefined filehandles

Example: translate Perl into HTML

Extreme powers of string manipulation

Pattern matching:

Examples:

Example: print only lines containing numbers

Application: make an index for a text document

Advanced Regular Expressions: substrings


lecture in color


downloaded on Nov-23-2009 04:17:58 PM,
was last modified on Dec-31-1969 07:00:00 PM.

All lecture note content is copyright 2003 by
Alva L. Couch, Computer Science, Tufts University
(couch at cs dot tufts dot edu)