in reply to Re: Hashes: Deleting elements while iterating
in thread Hashes: Deleting elements while iterating

<Grin>I think I was not clear enough or chose a less than obvious way to show things.</Grin>

Yes, that approach worked for me as well. It's when I use

foreach $key (%index){
that I get the errors.

If you look closely in the code I posted there are 3 loops above the delete operation, 2 of which are commented out. The ones commented out work, the other does not. I just change which one is UNcommented to test a particular way of doing it. I suppose this may seem unorthodox but it's just my way of trying to learn the differences/nuances of perl...

So, what's the problem you might ask? ;-)
Just seeking enlightenment as to why the one method gets errors (at least for me).

Thanks for testing it out for me.