Pedro Miguel Freire Custódio wrote: > Hi, > > this is probably a stupid question. The question is that I want a > particular class of objects to have several attributes, one of them a > list (array), the problem is that I can't get it to work, it only > stores the last value, and when I try to join another array it doesn't > work. If somebody could help me on this, I've tried some references and > stuff but i couldn't figure it out: > > package SpeechAct; > > sub new { > my $classname = shift; > my $self = {}; > bless($self, $classname); > $self->_init(@_); > return $self; > } > > sub _init { > my $self = shift; > $self->{OBJECT} = ['xpto1','xpto2']; > while (my $key = shift ) { > $self->{$key} = shift; > }
print "Got object[0] as $self->{OBJECT}->[0] and object[1] as $self->{OBJECT}->[1]\n"; > > } Try it with the changes made above. Each change was made for a specific reason. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>