A crude way to fix it: After your reassignment loop, delete keys until there are only 1 + (original)$num.
my $to_delete = keys(%hash) - $num+1; while ($to_delete) { --$to_delete if defined delete $hash{++$num}; }
In reply to Re: Re: Re: rebuilding hashes
by ysth
in thread rebuilding hashes
by coldfingertips
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |