my $seq = "XX**XXX!!!X**AB*!C*DXX*!!!XXX**XXX"; # The code presumes that it's a correct sequence. # If you're getting the sequence from somewhere else you # should check it to make sure it contains the right letters. print "#" . index($seq, "A") . "-#" . index($seq, "D") . "\n";