in reply to Re: Print hash value and key in for keys loop
in thread Print hash value and key in for keys loop

Thanks for the quick answer, brother danboo - that does the trick.   8^)

Actually, I do understand which is key and which is value (at least in the declaration chunk).   What's cornfusing here is that $oid{key} refers to the key, while $key refers to the value.   So to avoid that puzzlement, here's what I'm doing for now:

for (keys %oid) { if (defined(my $response = $session -> get_table(-baseoid => $oid{$_ +}))) { print "\n == $_ == $oid{$_} ==\n"; for my $r(oid_lex_sort(keys(%{$response}))) { print($response -> {$r}, ",\n"); } } else { print "Error: ",($session -> error(), ",\n"); } }

    cheers,
    Don
    striving toward Perl Adept
    (it's pronounced "why-bick")

Update:
Hrm... as good monk danboo points out below, I mispoke.   What I meant to say is "What's cornfusing here is that $oid{key} refers to the value, while $key refers to the key."   I really do understand key and value...   really...   honest   {grin}

Replies are listed 'Best First'.
Re: Re: (2) Print hash value and key in for keys loop
by danboo (Beadle) on Dec 14, 2001 at 03:39 UTC
    My pleasure to assist, though I think we're still not in agreement on our terms. $oid{$key} is not the key; $key is. $oid{$key} is the value. By using the key in the hash %oid we get back the value in return.

    Hopefully I'm not confusing the situation.

    - danboo