sub new{ my $class=shift; $class=ref($class)||$class; my $self= bless {}, $class; #self is now a "proper object". You can even subclass #this, and it will work correctly... #You may now call object methods, or set things in the #hash referenced by $self: $self->{state}="hungry" $self->feed(); return $self }