From: "Peña, Botp" Date: 2007-10-30T12:18:37+09:00 Subject: Re: find the closest items in an array to a given value. From: trebor777 [mailto:mrobert@trebor777.net] # a = myhash.keys.sort[value-0.05..value+0.05] # then i just use # myhash[a[x]] can you test without hash? ~> a => [1, 1.25, 1.9, 2, 3, 3.5] ~> val => 1.85 ~> a[val-0.5..val+0.5] => [1.25, 1.9] ~> a.slice (val-0.5..val+0.5) => [1.25, 1.9] kind regards -botp