-----Original Message-----
From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 31, 2001 10:30 AM
To: Kaleb Murphy
Cc: [EMAIL PROTECTED]
Subject: Re: Objects
On Fri, 31 Aug 2001, Kaleb Murphy wrote:
> Could someone give me an example of an object that has an array as a data
> member? Maybe a simple object and a simple method to return that array.
What have you tried so far?
-- Brett
http://www.chapelperilous.net/
------------------------------------------------------------------------
f u cn rd ths, itn tyg h myxbl cd.
This is one of my attempts to make this work. The method that returns the
scalar works. That method that returns the pointer to the array, doesn't
work.
sub test
{
package person;
sub new
{
my $package = shift;
my %args = @_;
my $self = \%args;
bless $self, $package;
$self;
}
package person;
sub get_name
{
my $self = shift;
$self->{"name"};
}
package person;
sub get_array
{
my $self = shift;
$self->{"array"};
}
}
$sname = "CblInfo";
for($i=0; $i<10; $i++){members->[$i] = $i;}
$a = new person(name => $sname,array => $members);
$name = "blah";
$name = $a->get_name;
$mem = $a->get_array;
print "$name\n";
for ($i = 0; $i < 10; $i++)
{
print "$mem->[$i]\n";
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]