Build a standard class
package Person; use strict; use warnings; sub new { my ($class) = @_; return bless { name => '', age => undef, }, $class; } sub name { my ($self, $name) = @_; $self->{'name'} = $name if $name; return $self->{'name'}; } sub age { my ($self, $age) = @_; $self->{'age'} = $age if $age; return $self->{'age'}; } 1;