"R. Joseph Newton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> "R. Joseph Newton" wrote:
>
> >
> > sub initialize {
> >     my $self = shift;   # references the oblect.
> >     my ($title, $purpose, $text) = @_;
> >
> >     $self->{'Title'} = $title;
> >     $self->{'Purpose'} = $purpose;
> >     push @{$self->{'Text'}}, $_  foreach @$text;
> >     return $self;
> > }
>
> Sorry, there was some wasted processing there.
> #    push @{$self->{'Text'}}, $_  foreach @$text;
> $self->{'Text} = $text;

Not really Joseph. Since $text is a passed-in array reference
the array that it points to could be altered after the object
has been built, so that the object's values would change.

You don't have to puh the array elements one by one though. I'd
do

  push @{$self->{'Text'}}, @$text;

Cheers,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to