S
sunil
Hi!
I have two simple questions. I am using PERL version 5.005 and
hence I should be able to preallocate hashes using something like:
keys(%myhash)=50000. But is there any way to verify this? When I do
scalar(keys%myhash), it shows 0.
Second question is about collisions when using hashes. I am assuming
that perl takes care of collisions so that if two keys happen to map
to same bucket, the new element will be placed either in linked list
or at next available slot in hash bucket array. But do hash functions
take care of this? For example if I call exists ($myhash{"hello"}) and
lets assume hash has key called "hallo" but not "hello". If both keys
"hallo" and "hello" map to same hash index,does
exists($myhash("hello")) return 0 as we expect?
Thanks,
Sunil.
I have two simple questions. I am using PERL version 5.005 and
hence I should be able to preallocate hashes using something like:
keys(%myhash)=50000. But is there any way to verify this? When I do
scalar(keys%myhash), it shows 0.
Second question is about collisions when using hashes. I am assuming
that perl takes care of collisions so that if two keys happen to map
to same bucket, the new element will be placed either in linked list
or at next available slot in hash bucket array. But do hash functions
take care of this? For example if I call exists ($myhash{"hello"}) and
lets assume hash has key called "hallo" but not "hello". If both keys
"hallo" and "hello" map to same hash index,does
exists($myhash("hello")) return 0 as we expect?
Thanks,
Sunil.