View Single Post
  #6   (View Single Post)  
Old 18th November 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Default

Quote:
Originally Posted by stukov View Post
Now, is a HASH an array itself?
No.

hashes can not have duplicate keys.

also, the keys in a hash are not ordered.

For example,
Code:
%hash1 = @array1; @array2 = %hash1 ; %hash2 = @array2;
array2 will likely have a different ordering from array1, hence different. but, hash1 will be the same as hash2.


arrays have a small performance advantage. and neither is particularly space efficient in perl.

Last edited by ephemera; 18th November 2008 at 07:13 PM.
Reply With Quote