in reply to Find a number in a list closest to a target

Keeping track of the difference and the closest time might be easier e.g
my $ctime = (stat($key))[10]; my($diff, $closest) = $ctime; for(@returns) { $closest = $_ and $diff = abs($ctime - $_) if abs($ctime - $_) < $diff; } print "closest match is - $closest\n";
The code is untested, but it should give you something to work with, and saves having to keep a hash around of all the differences and times.
HTH

_________
broquaint