in reply to Hash Internals
Deletions require splicing the two arrays, and then lowering the values in the %KEYINDEX hash. And if you want to allow for in-the-middle insertion, that requires splicing again, and raising the values in the hash.$orderedhash{$newkey} = $newvalue; # is really doing $next_index = @KEYS; $KEYINDEX{$key} = $next_index; push @KEYS, $key; push @VALUES, $value; $orderedhash{$oldkey} = $newvalue; # is really doing $key_index = $KEYINDEX{$key}; $VALUES[$key_index] = $value;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Hash Internals
by d_i_r_t_y (Monk) on Oct 23, 2000 at 02:22 UTC | |
by japhy (Canon) on Oct 23, 2000 at 02:31 UTC | |
by d_i_r_t_y (Monk) on Oct 24, 2000 at 07:53 UTC | |
by japhy (Canon) on Oct 24, 2000 at 16:06 UTC | |
by d_i_r_t_y (Monk) on Oct 25, 2000 at 07:48 UTC |