Struggling with scopes....
Ewen McNeill
ewen at naos.co.nz
Sun Dec 22 01:35:25 CST 2002
In message <0rna0vkgf3r9aenpf0s05im518t386lg34 at 4ax.com>, Enkidu writes:
>How do I stash %mindex or a pointer to it in the object hash, and how
>do I access it in the "nearness" subroutine?
Assuming that your object is a hash (rather than an array), you can
stick a reference to your %mindex hash into it under some suitable name,
eg:
$self->{'mindex'} = \%mindex;
And then you can pull it back out with something like:
$mindex_ref = $self->{'mindex'};
And use it as:
print $mindex_ref->{'thingy'};
Or:
foreach keys %{$mindex_ref}
{
print "Key: $_\n";
}
Or use it via the self hash directly:
print $self->{'mindex'}->{'thingy'};
Or whatever works for you.
This is "obvious" to me, and you say you couldn't find any obvious
solution to your problem, so perhaps I've misunderstood your problem; if
so feel free to explain some more.
Ewen
More information about the Wellington-pm
mailing list