Search on CPAN for
IntSpan. Something there should work for you I think (though if your numbers are not integers, you might have to scale them to be integers). I haven't used any of them, so I can't recommend anything.
Array::IntSpan or
Set::IntSpan perhaps. Or maybe one that claims to be "::Fast" :-)