Is it possible to evaluate a changing hash (changed within a loop)?

Let me fake an example for the problem -- Let's say I have a need to
traverse through a pedigree to find certain (qualified) ancestor for a
number of children, and count how many children a qualified ancestor
has. This process requires evaluation of the outcome at each
generation to be or not to be a qualified ancestor, or search will go

I'd like to design a hash to hold the current element children:

%examiner = (
'John', '1',
'Scot', '1',
... ...

I'd then loop the hash to search a database for the parents of each
child, see if it's a qualified ancestor: if yes, stop on this one; if
not, increment the number of children, and continue the search (next
would be evaluating the grant-parents, grant-grant-parents, and so
on).... until all children in the starting elements are traced to a
qualified ancestor.

while (($name, $count) = each %examiner ) {
# - find parent of $name
# - see of the parent qualify
# - if yes, update the %examiner to turn the "count" to "0";
# - if not, add new parent(s) to %examiner for next round
# - if all elements in the hash are "0", finish.

My question is, can a hash be updated while being evaluated? In other
words, can a hash be "re-evaluated" until its changing value satisfy
certain criteria?
So far, my experimenting shows it only evaluates each element once,
then quit, regardless how the hash content is changed. Is another loop
structure needed in order to loop for the 2nd, 3rd,... rounds
evaluation (on the updated hash)? Or there is a simpler way...?

Any advice is appreciated!