in reply to Closest-value-in-list Golf!
sub g{%_=map{abs$_[-1]-$_,$_}@_;$_{(sort{$a<=>$b}keys%_)[1]}} [download]