in reply to Re: when do i know that the iterator for a hash was reseted
in thread when do i know that the iterator for a hash was reseted

Thanks for your answer.
actually i think there is never a _real_ need to use each, as you can always do it using keys. The thing is i like to use each, because deeply nested hashes tend to get a bit more readable through the use of each (imo).
But i guess in some cases where i use while each, your code might be a good inspiration.
By what you and japhy posted, it seems to me that the only reliable way of getting all elements is keys. As with each you will "never know".
I find it somehow strange that while (my ($key , $val) = each %hash) is the recommended way (perlfaq) for getting all elements from a hash as the behaviour can get so quirky rather quick.
  • Comment on Re^2: when do i know that the iterator for a hash was reseted