Once the '2' element is deleted, you go through the hash with a counter and reassign (2 => 'three', 3 => 'four' ). The '4' element remains, as well.
I'm suspicious of the kind of sorting you do. What happens when you have 42 elements? Your sort will go 0,1,10,11,12... which I'm not convinced you will expect.
Why not use aa array for this? You can delete elements with splice and the renumbering will be automatic.
After Compline,
Zaxo
In reply to Re: rebuilding hashes
by Zaxo
in thread rebuilding hashes
by coldfingertips
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |