[Israel.pm] preallocation of hash buckets or arrays
Yossi.Itzkovich at ecitele.com
Yossi.Itzkovich at ecitele.com
Sat Mar 12 21:30:08 PST 2005
Hi,
In YAPC::Israel::2003 book I saw that Shlomo gave an example of
preallocation of hash buckets:
keys my %cache =@in;
my questions:
1) I always thought that keys() returns a copy of the hash' keys. According
to the code above, it looks like you can set the lnternal keys list. As it
true ?
2) Does this trick work with normal arrays too ? What is the syntax
(assuming I don't have such @in list as in the code above) ?
3) Is there any disadvantage of using this trick, assuming I know the
minimal size of the hash/array ?
Thanks
Yossi
More information about the Perl
mailing list