From: Mark Probert Date: 2003-08-28T05:12:17+09:00 Subject: sorting on hash contents Hi, all. Say I have a hash of 4 elements, val[1..3] and name h["a"] = "1,2,3,fred" h["b"] = "4,1,2,jack" h["c"] = "3,3,4,jill" How do I define: def sort_hash(field="val1") h.each { |key, data| (val1, val2, val3, name) = data.split(/,/) # etc.. end elegantly? One possibility is to write it out to a tempfile and use the external `sort` command. Is there an easy pure-ruby solution? TIA, -- -mark.