Re: Array as instance variable
- From: anno4000@xxxxxxxxxxxxxxxxxxxxxx
- Date: 11 Dec 2006 11:13:46 GMT
Uri Guttman <uri@xxxxxxxxxxxxxxx> wrote in comp.lang.perl.misc:
"rw" == robert waters <robert.waters@xxxxxxxxx> writes:
rw> Also, how would I go about populating that array inside the
rw> constructor?
this is in response to BOTH of your postings. please even quote yourself
if you have to do this.
you can use ANY reference for an object, not just hashes. hashes just
are the most common and usually direct way to do perl objects. get the
book Object Oriented Perl by damian conway and learn how to make objects
out of any ref including arrays. that will also show you how to
initialize them (hint: just the same as with any array you need to
init).
That is an excellent solution if the array is the only data to be
kept in the object. If the array is just one field among others,
there is no other way than than to use an arrayref much like the OP
did.
Anno
.
- Follow-Ups:
- Re: Array as instance variable
- From: Uri Guttman
- Re: Array as instance variable
- References:
- Array as instance variable
- From: robert.waters
- Array as instance variable
- From: robert.waters
- Re: Array as instance variable
- From: Uri Guttman
- Array as instance variable
- Prev by Date: Re: Removing entry from @rray
- Next by Date: Re: Removing entry from @rray
- Previous by thread: Re: Array as instance variable
- Next by thread: Re: Array as instance variable
- Index(es):
Relevant Pages
|