I'd pass $key_val in as a third parameter (actually the second parameter with $key the last). However, that doesn't seem to be the real problem. I suspect all you need to do is assign an empty hash to $key_val between iterations to clear the previous contents.
In reply to Re^3: Recursive search in nested hash for selective keys
by GrandFather
in thread Recursive search in nested hash for selective keys
by perlpal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |