I understand that a perl object is much like a hash ref, but not the 100% same.
For instance, it is easy to loop through a hash ref:
But I don't know how to loop through an object like:
If I knew the obj '$obj' has some data members, then I know how to reach it:
Thanks in advance for your help.
For instance, it is easy to loop through a hash ref:
Code:
if(ref($var) eq 'HASH') {
foreach my $key (keys(%{$var})) {
print "Key: $key, Val: $var->{$key}\n";
}
}
But I don't know how to loop through an object like:
Code:
my $obj = someModuleName->new();
If I knew the obj '$obj' has some data members, then I know how to reach it:
Code:
print "$obj->{dataMember1}\n";
Thanks in advance for your help.