[Wellington-pm] Creating an array of objects
enkidu at cliffp.com
Sat Mar 11 00:58:12 PST 2006
I'm not very good at the OO stuff, so bear with me, please!
What I want to do is create an array of objects. Or is that an array of
object references. I'm not sure.
I can, I believe, instantiate an object as follows (please correct me if
my $foo = MyPackage->new('bar') ;
Is $foo an object or an object reference?
I basically want to create an array of objects or object refs, so can I do :
$foo = MyPackage->new('tut') ;
$foo = MyPackage->new('ankh') ;
$foo = MyPackage->new('amun') ;
Obviously this could be done using a loop, but what if I needed an array
of a hundred of them? Is there a clever way to instantiate a hundred
objects of a particular class?
Am I making sense? The experienced OO programmers are probably laughing
themselves silly by now....
More information about the Wellington-pm