#! perl -slw use strict; package Cish::Person; use Class::InstanceVariables qw( $first $last $middle ); sub new{ my $class = shift; local $self = instance(); ( $first, $middle, $last ) = @_; $self; } sub full_name{ local $self = shift; "$last, $first $middle"; } sub marry{ local $self = shift; my $spouse = shift; "$first married " . $spouse->first(); } package Perlish::Person; sub new{ my $class = shift; my $self = {}; @{ $self }{ qw[ first middle last ] } = @_; bless $self, $class; } sub full_name{ my $self = shift; join ' ', @{ $self }{ qw[last first middle ] }; } sub marry{ my $self = shift; my $spouse = shift; "$self->{ first } married " . $spouse->{ first }; } package main; use Benchmark qw[ cmpthese ]; my %tests = ( Cish => q[ my $john = new Cish::Person(qw(John F Jones)); my $sue = new Cish::Person(qw(Suzy P Edwards)); print STDERR $john->full_name(); print STDERR $sue->full_name(); print STDERR $john->marry($sue); ], Perlish => q[ my $john = new Perlish::Person(qw(John F Jones)); my $sue = new Perlish::Person(qw(Suzy P Edwards)); print STDERR $john->full_name(); print STDERR $sue->full_name(); print STDERR $john->marry($sue); ], ); cmpthese( -3, \%tests );