From: Brian Candler Date: 2003-04-09T18:43:16+09:00 Subject: Re: Hash table order On Wed, Apr 09, 2003 at 06:38:36PM +0900, Szymon Drejewicz wrote: > => {"HEAD"=>"ASD", "LONG_TABLE_HEAD"=>".zx,cmvn;alksdjf > a.s,dmnf;ioxcvuaw.,.mnsdfl;k", "TABLE_HEAD"=>"SKSKJKDKSKKSDJKSKDJSKJDKS > SKDJSKDJS"} Hashes are unordered, by definition. A hash works by dividing the keys into "buckets", where each key is passed through a hashing function, and all keys with the same hash function result end up in the same bucket. So traversing the hash (with 'each', for example) will give you an element ordering which depends on their hash values, not strictly in the order in which they were inserted. If you need the order preserving then use an array. Regards, Brian.