in reply to Re: Print hash value and key in for keys loop
in thread Print hash value and key in for keys loop
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"); } }
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 |