Using
keys and a
foreach loop will create a temporary list of all the keys. With small hashes that probably won't make much difference, but an alternative way is to use
each which returns the key and value on each iteration in a
while loop, for example:
while (my ($host, $value) = each(%rez)) {
# More nested while loops
}
update corrected with
each in code (thanks
Hue-Bond)