in reply to Re^3: 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

We are experiencing communication problems :)

Thanks for all the time you took to show me some alternatives. The thing is: the reason why i posted isn't how to find a hash element, but that i had a problem with the use of &each, which i wanted to share with the rest, in case there are more out there who don't understand its correct use.

I already use those lowercased keys in diffrent parts of my programm, but in this case i refrained from using it, as this hash is generated by a general purpose parser, which i don't want to modify as it also is used in other sections of the programm. I also don't want to create an additional hash with the data reorderd in a diffrent way, as i already have about 10hashes in this subroutine alone, with data from diffrent files/subroutines which i have to compare inside this routine. Also, this function is called only for rare exceptions, and the amount of keys on the first hirarchy level of my nested hash has never more than 10 elements ... (i am comparing the keys of that first level) .

Plus the Problem what i tried to explain to you before, that i don't know the values which Irrelevant_String might asume - its not fixed, and not under my control. It might be banana , gwbush, horse or Xzadd##fasdafa33. Like that i can't use exist. Of course i might create a new hash which has What_I_am_looking_for lowercased and Irrelevant_String trimmed from it as the new key and the original key stored in the array-ref as you showed in your above example. But that would be another hash, and in my case not worth the overhead (called seldomly).

As you probably aren't a telecommunication-telepath you couldn't know that. I just wanted to clarify, that this "finding the hash key" wasn't the central part of this node, but the reseting and not_reseting of the hash iterator, when one leaves a while-each loop through use of last or return, as this behaviour wasn't clear for me.
  • Comment on Re^4: when do i know that the iterator for a hash was reseted