is too much, since $a<=>$b is the default sort. that leaves you withsort{$a<=>$b}keys%h
for 52.sub g {$n=pop;$h{abs($_-$n)}=$_ for@_;$h{(sort keys%h)[0]}}
In reply to (boo)Re: Re: Closest-value-in-list Golf -- or, a sorted affair.
by boo_radley
in thread Closest-value-in-list Golf!
by larryk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |