- or download this
# Parent
sub get_child_id {
...
# Find the index of the child. Left as exercise for the reader (read
+: I'm too lazy :) ).
return $child_index;
}
- or download this
# Child
sub whereami {
...
my $id=$parent->get_child_id($self);
}
- or download this
my $self = {
parent => \$parent;
};
- or download this
my $self= { parent => $parent }; #$parent is a ref, you were storing a
+ ref to $parent