in reply to overlap between ranges

I would assume that the usual definition of overlap applies - that two sets overlap if they contain at least one common element.

You haven't described what you've tried so far, so I'm going to only outline some potential approaches. As this is not a program writing site, but a site for discussion and help with specific programming problems, you won't get a complete program from me.

The naive approach:

  1. Generate all elements for the range
  2. Check for every two ranges whether they overlap by checking whether they contain common elements. See perlfaq4.

The direct approach

Note that two ranges overlap if

  1. For each range, check if they fulfill the modified criteria against each other range

There are other possibilities, like sorting your ranges by lower boundary and then checking for overlap - if you do it that way, you will need to add some more criteria for completely contained subranges.