in reply to Re: Re: quick question about hash element access
in thread quick question about hash element access

Interesting. But I have a question (not being totally fluent in references).

What exactly does the $thingy = $$thingy{$key} line do? My guess is that it assigns a scalar value referred to by the reference which is contained in $thingy{$key}. But I'm not even sure that sentence makes sense, much less if it's accurate. :)

Replies are listed 'Best First'.
Re: Re: Re: Re: quick question about hash element access
by LanceDeeply (Chaplain) on Jun 27, 2003 at 22:32 UTC
    you are correct sir-
    we are assigning $thingy to the value of whatever is refered to by $thingy{'a'}, in this case, it's the next hashref. this assignment is just repeated a few times till we're all out of keys.

    what's bad about this is that it assumes the caller will pass in a valid path. i guess error checking will be left up to OP...
Re: Re: Re: Re: quick question about hash element access
by argggh (Monk) on Jun 28, 2003 at 14:06 UTC
    $$thingy{$key} is equal to $thingy->{$key}, so it returns the value corresponding to the key $key in the hash pointed to by the reference $thingy.