Finding overlapping ranges in Perl

Finding if a value is in a range is something you come across quite often. For instance, perhaps you want to see if a sequence is in a particular region. Or in my case it is to find if two genes overlap.

One could solve this in a lot of different ways, but the one I found recently was using the perl module Number::Range.
For this all you need to do is set up the two ranges, and then make a small test to see if you sequence overlaps this. It could look something like this:

This could then easily be put into a subroutine.
Maybe there are better solutions out there. Let me know!