use strict; use warnings; my $start = 'CTGCCACCGCTGT'; my $end = 'ACCGCTGTGTTTCGGCCGGCGA'; my $pos = 0; $pos++ while (!(substr($start, $pos, (length $start) - $pos) eq substr($end, 0, (length $start) - $pos))); print substr($start, $pos, (length $start) - $pos), ' ', $pos+1, "\n";