in reply to Re (tilly) 1: Closest-value-in-list Golf!
in thread Closest-value-in-list Golf!
how come you use ( ) on one abs but not the other? :-)
pop and no ref...
Update:sub g {(sort{abs$a-$_[1]<=>abs$b-$_[1]}@{$_[0]})[0]} # 44 chars
pop and no ref...
fantastic - that's exactly half my originalsub g {$n=pop;(sort{abs$a-$n<=>abs$b-$n}@_)[0]} # 39 chars
"Argument is futile - you will be ignorralated!"
In Section
Meditations