in reply to Re^4: Array or Hash
in thread Array or Hash
I am surprised that perl is inefficient with sparse arrays.
It's more than a little inaccurate to say that, given that Perl doesn't even attempt to implement sparse arrays.
You might just as well say that Perl is inefficient at implementing birth control or nuclear fusion :)
I guess that if I need to create one, I should in future use a hash with numbers as the keys.
Indeed. If your "array" is likely to be less that 45% full, using a hash with numeric keys will save you memory at the cost of a little speed.
|
|---|