www.perl.com
Perl Programming
Three Rules
  • To create a class, build a package.
  • To create a method, write a subroutine.
  • To create an object, bless a referent.
    • bless is a special operator that makes a referent an object.
    • In Perl, objects are usually constructed from hashes.

        package MyCar;

        # Constructor method
        sub new {
          my $self = { wheels => 4,
                       speed  => 0,
                       gas    => 10};
          bless $self, "MyCar";
        }
      
Previous http://stuff.mit.edu/iap/perl/