Home: Perl Programming Help: Beginner:
More complex Objects



Alexey
Novice

Dec 20, 2007, 2:53 PM


Views: 640
More complex Objects

My understanding is that i have to use array or hash as an internal data structure of my object. I can have another object (or a reference to an object as a part of my hash and it works). However if i want to have another array or a hash as a part of my object i can not store it in my anonymous hash field. For example, field1 of my has will have a string, field2 -> another object or a reference to an object, field3 -> array of strings or objects, field4 -> another hash. Is that possible?
Or do i have to use something like Class::Struct? Is there anything else other then C++ like structs i can use (may be something similar to Java objects)?
Thanks


KevinR
Veteran


Dec 20, 2007, 7:28 PM


Views: 637
Re: [Alexey] More complex Objects

What you want to do is possible but you have to learn how to use references in order to create complex data sets. See if this helps you to understand how to construct those data sets using perl:

http://perldoc.perl.org/perldsc.html
-------------------------------------------------


Alexey
Novice

Dec 20, 2007, 9:19 PM


Views: 635
Re: [KevinR] More complex Objects

Thank you. That helped a lot. Now i just will have to decide if it is easier to use Class::Struct or conquer the references Smile