in reply to Re^3: Regex to match range of characters broken by dashes
in thread Regex to match range of characters broken by dashes

... local our $q = $s - 1; fixes [the lexical bug].

It can even be fixed a bit more cleanly, and also fold in the added  s/// fixup at the end (still runs under 5.8.9):

c:\@Work\Perl\monks\Q.and>perl -wMstrict -le "my @stops = (2,6); ;; my $tag = '___'; ;; for (qw(ATCGGATCTGGC A-C-G--CTGGC)) { my $seq = $_; printf qq{'$seq' -> }; $seq =~ s{ ((?: [TAGC] [^TAGC]*){$_} [TAGC]) [^TACG]* }{$1$tag}xms for map $_-1, @stops; print qq{'$seq'}; } " 'ATCGGATCTGGC' -> 'AT___CGGA___TCTGGC' 'A-C-G--CTGGC' -> 'A-C___G--CTG___GC'


Give a man a fish:  <%-{-{-{-<