If I have a Perl hash with a bunch of (key, value) pairs, what is the preferred method of iterating through all the keys? I have heard that using each may in s
A few miscellaneous thoughts on this topic:
values returns aliases which means that modifying them will modify the contents of the hash. This is by design but may not be what you want in some circumstances.each. This is not true for keys as each is an iterator while keys returns a list.