Thanks a million. But still I have another problem. Figure that I can 
take it on from all your guys' help, but I can't.

A more controlled sort. I only want to sort the keys where the values 
from myhash follows this pattern of [i,j], [i+1,j+1]...  think of it as 
a 2-D matrix and I am only interested in the diagonal line. I am not 
worried about the duplicates of coordinates, as one coordinates can only 
have one occurrence(or building).

For example, the sorted result for the following hash will be:

myhash = {"a"=>[[0, 0], [3, 4]], "b"=>[[1, 1], [9, 8]], "c"=>[[7, 6],[4, 
5]}

[[0, 0], [1, 1], [3, 4], [4, 5]]
"a", "b", "a", "c"

Cheers

-- 
Posted via http://www.ruby-forum.com/.