in reply to Find a number in a list closest to a target
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.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";
_________
broquaint
|
|---|