You could also just have one method that is both a getter and setter
sub level {
my $self = shift;
if ( @_ ) { $self->{ Level } = shift;
return $self->{ Level };
}
What we are doing is checking if any other arguments are passed,
apart from the reference to the object i
Assuming I am defining an object which has as its only property a level
associated with it, would these be the correct simple subroutines to
retrieve and set that property. Also, is this the correct usage of the @_
array such that the level value would be 999 unless I called new(Level =>
somet