F
freesoft12
Hi,
Inside my Perl Object, I use a hash to store all the data.
I want to access the data inside the hash using accessors. If I had an
array, I would provided methods to return the size of the array and
then a method for getting the i'th data i.e.
# $obj is an object of my class
my $size = $obj->get_size_of_array();
for ($i = 0; $i < $size; ++$i) {
my $value = $obj->get_value($i); # i would return array[$i]
}
How can I create accessors for the data inside a hash? Or can I return
a constant reference to the hash (like in C++)?
Regards
John
Inside my Perl Object, I use a hash to store all the data.
I want to access the data inside the hash using accessors. If I had an
array, I would provided methods to return the size of the array and
then a method for getting the i'th data i.e.
# $obj is an object of my class
my $size = $obj->get_size_of_array();
for ($i = 0; $i < $size; ++$i) {
my $value = $obj->get_value($i); # i would return array[$i]
}
How can I create accessors for the data inside a hash? Or can I return
a constant reference to the hash (like in C++)?
Regards
John