Thanks, yes agreed. My code was simplified and there are multiple key/value pairs in the actual data. | [reply] |
Hmm, maybe I misunderstood, but this is difficult to follow.
On one hand you ask for a value of a hash with one entry,
OTOH you state this situation is simplified, in your real code there are more entries.
But if there are multiple entries in the hash, LanX's suggestion will put the value of a randomly choosen hash entry in $value. This might not be what you want.
So I suggest defensive coding:
first check if the hash only holds one entry
if (1 == scalar keys %hash)
before (blindly) retrieving a value.
| [reply] [d/l] [select] |