The code is modifying the hash while iterating over its values and using those values as the keys for deletion. You perhaps already tried this, but if you change the loop to iterate over @values or the keys of $hr3 then the issue disappears. Same if you stringify the loop iterator $v.
Others can better comment on the details, but I assume perl is re-using memory and your code is reaching into the old locations.
In reply to Re^3: Use of freed value in iteration
by swl
in thread Use of freed value in iteration
by js1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |