in reply to Find range in array with indices

7.23 is considered bigger than 7.133 (however, in terms of coordinates the opposite is the truth)

Can you explain this? How is 7.23 not bigger than 7.133?

And what should happen when the given number isn't in any of the ranges?

Replies are listed 'Best First'.
Re^2: Find range in coordinates array
by Fletch (Bishop) on Sep 30, 2019 at 18:44 UTC

    I'm not sure I'm reading the OP right but I think that their list of numbers is really [start,end] pairs encoded as decimals. "7.23" means the range from character 7 to character 23, which is contained in the range [7,133]. Probably needs to split the string representation into pairs (maybe in an array ref) and then use an in_range( $range, $start, $end ) sub to check.

    Or something . . . </handwave>

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.