package Person; require 5.004; #use strict; my $Person; # These Variables are Static variables. # All Person objects share these variables. $Person::version = "1.00.01"; $Person::build = "\$ID:2255518"; # this only lets you create one person. I don't think you # whan to do that. # $Person::list = {}; sub new { my $class = shift; # $person is a blessed reference to an anonymous hash my $Person = {}; my $Person = bless $Person, $class; return $Person; } sub name { # Get the reference to the hash that represents this person $Person = shift; # Set the name member of the anonymous hash to the argument # of this function. $Person->{NAME} = shift; return $Person->{NAME}; } sub age { # Get the reference to the hash that represents this person $Person = shift; # set the age member of the anonymous hash to the argument $Person->{AGE} = shift if @_; return $Person->{AGE}; } sub exclaim { # Get the reference to the hash that represents this person $Person = shift; printf "I'm %s and i'm %d years old!\n", $Person->{NAME},$Person->{AGE}; return 1; } return 1;