my $max_inf = $first_beg > $second_beg ? $first_beg : $second_beg; my $min_sup = $first_end < $second_end ? $first_end : $second_end; if ($min_sup - max_inf >= 5) { #...