Perl 201

Riding the Camel

Douglas E. Miles

  1. Introduction
    1. Perl 201 is an introduction.
    2. Documentation
      1. man perl (or HTML equivalent)
      2. Programming Perl (O'Reilly)
      3. Object Oriented Perl (Manning)
      4. Perl Cookbook
      5. Mastering Regular Expressions (O'Reilly)
      6. CPAN - http://search.cpan.org/
      7. Google
  2. Strict and Warnings
    1. Strict
      1. use strict; # apply all possible restrictions
      2. use strict 'vars'; # restrict unsafe use of variables for rest of block
      3. use strict 'refs'; # restrict unsafe use of references for rest of block
      4. use strict 'subs'; # restrict unsafe use of barewords for rest of block
    2. perl -w;
  3. Scope
    1. Programming Perl 2nd ed. Ch. 2 Section 6.8

      A local variable is dynamically scoped, whereas a my variable is lexically scoped. The difference is that any dynamic variables are also visible to functions called from within the block in which those variables are declared. Lexical variables are not. They are totally hidden from the outside world, including any called subroutines (even if it's the same subroutine called from itself or elsewhere - every instance of the subroutine gets its own copy of the variables). In either event, the variable (or local value) disappears when the program exits the lexical scope in which the my or local finds itself. By and large, you should prefer to use my over local because it's faster and safer. But you have to use local if you want to temporarily change the value of an existing global variable, such as any of the special variables listed at the end of this chapter. Only alphanumeric identifiers may be lexically scoped.
    2. my
    3. local
  4. Regular Expressions
    1. Line Noise
    2. Examples
  5. References
    1. Symbolic
    2. Hard
  6. Data Structures
    1. man perldsc
    2. List of Lists (Array of Arrays)
    3. List of Hashes (Array of Hashes)
    4. Hash of Lists (Hash of Arrays)
    5. Hash of Hashes (Hash of Hashes)
  7. Packages
    1. Typeglobs - Everything named 'foo' or a symbol table entry. i.e. $foo, @foo, %foo, &foo, and foo.
    2. Symbol Tables - Hash whose name is the same as the package with '::' appended.
  8. Objects
    1. A class is a package.
    2. An object is a referent (something being refered to) that knows which class (package) it belongs to.
    3. A method is a subroutine that expects an object reference (or a package name, for class methods) as its first argument.
    4. Example
  9. Modules
    1. Same name as package and ends in .pm, and '::' changes to '/'.
    2. h2xs
    3. Comprehensive Perl Archive Network - http://www.perl.com/CPAN/
    4. perl -MCPAN -e shell
  10. References
    1. Learning Perl (The Llama)
    2. Programming Perl (The Camel)
    3. The Perl man pages
    4. Object Oriented Perl
    5. perltoot (Tom's Object-Oriented Tutorial)