From: "Bryan R Harris" <[EMAIL PROTECTED]> > (This is still the beginner's list, right?) > > I'm surprised at how often the answer to a question is "You should be > using a hash, not an array." So my question is, how many keys is too > many? Is there a rule of thumb? (like "if you have over 500,000 > items, use a 2-d array instead of a hash")
It's not about the number of items. If you need to index the items by something else than positive integers ... you have to use a hash. If the keys are sparse (you need to have element 1, 1457, 9784 and 46486, but not the others) you should use a hash. How to implement multidimensional arrays is another question. It depends on the task. If the array is sparse, $hash{$x,$y} will work better, if it's not, use either $array[$x][$y] or (if the rows are of the same length that is known) $array[$x + $rowsize*$y]. Jenda =========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ========== There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]