in reply to Re: Re: rebuilding hashes
in thread rebuilding hashes
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}; }
|
|---|