my %tmphash; my $ctime = (stat($key))[10]; print "IN MULTIPLES \$ctime is $ctime\n"; for (@returns) { print "Working Multiple match: $_\n"; $tmphash{abs($ctime - $_)} = $_; } print "MULTIPLE MATCH best match = ". $tmphash{(reverse(sort(keys(%tmphash))))[0]}."\n";