in reply to Binary search algorithm

-1 is a shortcut index for the final element of an array. $# is the index of the final element of the array. The difference is subtle and important.

Besides that, ranges always increase. You can't go from 0 to -1 by adding one -- at least, not anytime soon. It's a meaningless construct.