On Fri, 13 Aug 2004 10:28:17 -0700, you wrote:

>Also, does anyone know how to predefine the length of a hash with multiple
>keys?
>
>This defines 10,000 key/value pairs.
>       %hash = 10_000;

No, it doesn't--that is equivalent to

%hash = (10_000, undef);

(Turning on warnings would have told you this.) What you're probably
thinking of is

keys(%hash) = 10_000;

but that allocates 10,000 (OK, actually 16,384) buckets for the hash,
which isn't really the same thing as key/value pairs.

>How do you pre-define key/value pairs for $hash{key1}{key2}{key3}   ?

If you really feel this is necessary, remember that $hash{key1} and
$hash{key1}{key2} are both hash references, so you would have to do
something like

keys(%{$hash{key1}}) = 1000;
keys(%{$hash{key1}{key2}}) = 1000;

I'm not even sure this will work, and I frankly think it's a waste of
time.

-- 
Eric Amick
Columbia, MD

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to