in reply to Re: can I change hash keys or values directly
in thread can I change hash keys or values directly
Sorry, but from my understanding this is incorrect.
There is a Linked List with keys and values in a fixed randomized order which is used by iterators like each , as well as keys and values
There is also a C-Array of "Buckets" for quick look up via hash-function, and these "Buckets" also point to a Linked List with all entries having the same hash-value aka "Collisions".
But this array is not traversed to generate the output for keys
Sorry ... looks like I had an incorrect or outdated source
according to https://www.cpan.org/authors/id/G/GA/GAAS/illguts-0.09.pdf
* RITER, EITER: The first two fields are used to implement a single iterator over the + elements in the hash. RITER which is an integer index into the array referenced by ARRAY an +d EITER which is a pointer to an HE. In order find the next hash element one would first + look at EITER->next and if it turns out to be NULL, RITER is incremented until ARRAY[RITE +R] is non-NULL. The iterator starts out with RITER = -1 and EITER = NULL.
and I'm not sure if this is still up to date, since new security requirements led to more randomization
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: can I change hash keys or values directly (UPDATED)
by Marshall (Canon) on Feb 04, 2021 at 21:27 UTC | |
by LanX (Saint) on Feb 04, 2021 at 23:29 UTC | |
by Marshall (Canon) on Feb 05, 2021 at 03:43 UTC | |
by LanX (Saint) on Feb 05, 2021 at 08:38 UTC | |
by Marshall (Canon) on Feb 05, 2021 at 09:13 UTC | |
by LanX (Saint) on Feb 05, 2021 at 16:11 UTC | |
by Marshall (Canon) on Feb 08, 2021 at 18:53 UTC | |
|