package TestObjects; use strict; use warnings; my @objects; sub new{ my ($class) = @_; my $self = {}; bless $self,$class; push @objects,$self; return $self; } sub name{ my ($self,$name) = @_; $self->{NAME} = $name if defined $name; return $self->{NAME}; } sub properties{ my ($self,@properties) = @_; $self->{PROPERTIES} = [@properties] if @properties; my @array; @array = @{$self->{PROPERTIES}} if defined $self->{PROPERTIES}; return @array; } sub find{ my ($class,$name) = @_; for my $obj( @objects ){ if( $obj->name eq $name ){ print $obj->name," -> ",join("..",$obj->properties),"\n"; } } } 1;