http://qs1969.pair.com?node_id=1060352


in reply to Calculate the overlap length between two ranges

Please have a look at this module Set::IntSpan.

#!/usr/bin/perl use strict; use warnings; use Set::IntSpan; my $set1 = new Set::IntSpan '31-52'; my $set2 = new Set::IntSpan '27-50'; my $u_set = intersect $set1 $set2; my @set = sets $u_set; print @set; __END__ output: 31-50

Update: code + typo


hth,
PooLpi

The stone that the builder refused, will always be the head cornerstone.
[ Robert Nesta MARLEY ]