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


in reply to Array, element inside limits

First, don't use $a and $b in your actual code, unless you're in a sort block. They're semi-reserved names.

Second, it sounds like simply binary searching your array for your upper bound and finding the first value less than that upper bound should get you your answer, as long as it's greater than your lower bound. No?


Mike