Well I think this is the easiest to answer, the basic mechanism is a hash-function mapping a key to an array-index for a lookup mechanism. °
And this means a stored key must be immutable , because that calculated array-index would change too.
Consequently there can't be a faster way than replacing the whole key-value pair with "delete OLD" + "store NEW".
All the other implementation details we discussed are about various other features and performance.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) That's why Perl's associative arrays are called "hashes" in the first place.
In reply to Re^4: can I change hash keys or values directly
by LanX
in thread can I change hash keys or values directly
by misterperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |