[-
package test::object ;
sub id
{
my $self = shift ;
return "id $self->{n}" ;
}
sub name
{
my $self = shift ;
return "name $self->{n}" ;
}
sub new
{
my $class = shift ;
my $n = shift ;
my $self = {n=>$n} ;
bless $self, $class ;
return $self ;
}
-]
[-
test::object->new (0) ;
-]
[-
$obj[0] = 1 ;
-]
[-
$obj[0] = test::object->new (0) ;
$obj[1] = test::object->new (1) ;
$obj[2] = test::object->new (2) ;
$obj[3] = test::object->new (3) ;
-]