in reply to Re: Using 'each' to get random (key, value) pair from hash returns "uninitialized value"
in thread Using 'each' to get random (key, value) pair from hash returns "uninitialized value"
Thanks. I had actually read that sentence but had 'misunderstood' it - thinking of it only in the foreach loop context and not realizing the same thing applies in a non-loop. By the way, your analogy was really helpful.
If I am now understanding the sentence correctly, I can do something like the following:
($key, $value) = each %hashCache || each %hashCache;Presumably this would 'eat' the 'undef' token and make the lazy-a** conductor go back to the front of the bus and start collecting tickets again :)
|
|---|