use Person;
use strict;
my @employees = [];
foreach (qw(John Betty Larry Joe Sally Laura Bubba)) {
my $person = Person->new();
$person->name($_);
push @employees, $person;
}
####
foreach my $employee (@employees) {
print $employee->name(), "\n";
}
####
print ref($employee), "\n";
####
package Person;
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
$self->{NAME} = undef;
bless ($self, $class);
return $self;
}
sub name {
my $self = shift;
if (@_) { $self->{NAME} = shift }
return $self->{NAME};
}
1;