in reply to Re^4: Find the boundaries of a substring in a string
in thread Find the boundaries of a substring in a string

I added that and it works fine now, thank you!
my $seg_end = pos ($seq)-1; my $seg_start = $seg_end - $seg_length+1;