in reply to Re^2: Use of freed value in iteration
in thread Use of freed value in iteration
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Use of freed value in iteration
by Danny (Chaplain) on Feb 12, 2024 at 23:02 UTC | |
by swl (Prior) on Feb 12, 2024 at 23:30 UTC | |
by choroba (Cardinal) on Feb 13, 2024 at 12:46 UTC | |
by Danny (Chaplain) on Feb 13, 2024 at 16:35 UTC | |
by hv (Prior) on Feb 13, 2024 at 17:21 UTC | |
by syphilis (Archbishop) on Feb 14, 2024 at 00:11 UTC | |
|