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
In reply to Re: Calculate the overlap length between two ranges
by poolpi
in thread Calculate the overlap length between two ranges
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |