package TESTOBJ; my %fields = ( __name => undef, __mpp => [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ] ); sub new { my $that = shift; my $class = ref($that) || $that; my $self = { %fields }; bless $self, $class; return $self; } sub name { my $obj = shift; @_ ? $obj->{__name} = shift # modify attribute : $obj->{__name}; # retrieve attribute } sub mpp0 { my $obj = shift; @_ ? $obj->{__mpp}[0] = shift # modify attribute : $obj->{__mpp}[0]; # retrieve attribute }