Your observations about similarities are true!
For instance in JavaScript arrays are (officially) implemented via hashes. =)
BUT there are certain differences in Perl.
- arrays are ordered, hashes aren't
- two indices with distance n mean the array has >n elements, the hash only >2
- array lookup and memory consumption is far better for same number of elements
These differences in nature lead to different operators, something like
push or
shift doesn't make much sense for hashes without order. How do you find the highest index/key of an array?
And sometimes, e.g. when dealing with sparse matrices, arrays are simulated via hashes.
HTH
Cheers Rolf
( addicted to the Perl Programming Language)