in reply to Nested iterations throgh hash

But what is the best practical solution for this task?

But what is the task? Is it to access the "next" key/value element of the hash in the inner loop? If so, then an array structure would seem more appropriate since a hash has no inherent order beyond key-value pairing (but there are tie-ed, ordered hashes). (Update: As to copying, if you make a copy of the hash by value, you will just end up with two independent each iterators for each copy. If you make a copy of the reference, you're still just operating on the same hash referent!)

What output do you want from your code?


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^2: Nested iterations throgh hash
by luxs (Beadle) on Feb 11, 2020 at 20:33 UTC

    In this example, I've try to make the problem very simple, without overwhelming practical applications.

    But the main idea is - I need to do some job for each hash pair. And during this job, I do need to calculate some information related to all pairs from this hash for example.