It seems incorrect to print 100 when the input is 0. Beware backing around the corner of Perl's arrays.
Be well,
rir
In reply to Re: find closest element of array without going over
by rir
in thread find closest element of array without going over
by sadfaceman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |