package board; ... use lib('.'); use hole; # # new - board constructor # # holes ) is an ref to a array of hole objects # This is not typically passed in to the # constructor. The constructor will build # the holes attribute $holes is not passed. # # level ) is also not typically used. # sub new { my ($pkg, $holes, $level) = @_; unless ( $holes ) { # # create the holes # ... } my $obj = bless { holes => $holes, # ref to array of holes level => defined( $level ) ? $level : 0 }, $pkg; return $obj; } sub getHoles { my $obj = shift; return wantarray ? @{$obj->{'holes'}} : $obj->{'holes'}; ... 1; }