You are completely right: all the hash complexities are handled by perl. I've mention that to let the author of the original question got an impression, how it works, and, implement his own logic, if the standard hashes aren't enough for him.
BTW, does perl caches the string hash value? I.e. is the following approach:
my $index = $hash->{$string}; ... my $value1 = $array1->[$index]; my $value2 = $array2->[$index]; ... my $valueN = $arrayN->[$index];
comparing to the following approach:
my $value1 = $hash1->{$string}; my $value2 = $hash2->{$string}; ... my $valueN = $hashN->{$string};
I.e. I know that number of keys is fixed and isn't changed at runtime, so, I sort them, and store their order in hash, and then in future I always use arrays to store/retrieve values associated with string.
Is the first approach faster than the second?
In reply to Re^3: Generating Unique numbers from Unique strings
by basiliscos
in thread Generating Unique numbers from Unique strings
by rjohn1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |