http://www.perlmonks.org?node_id=84441


in reply to Closest-value-in-list Golf!

Not the shortest, but this was what was obvious to me...
sub c { #_123456789_123456789_123456789_123456789_12345 $i=pop;for(@_){$c=$_ if abs$i-$c>abs$i-$_}$c }
Chris