Struggling with scopes....

Enkidu enkidu at cliffp.com
Sun Dec 22 02:24:49 CST 2002


On Sun, 22 Dec 2002 20:35:25 +1300, you wrote:

>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, it's because I'm still learning.... I haven't got my head around
the whole data type thing yet.

And thanks, it now works with the help of your hints above.

Cheers,

Cliff
--  

The Nats held a Party and no one came.



More information about the Wellington-pm mailing list