in reply to Re^2: Print A Sequence with Start codon and different Stop Codon
in thread Print A Sequence with Start codon and different Stop Codon

See "(??{ code })" in perldoc perlre

  • Comment on Re^3: Print A Sequence with Start codon and different Stop Codon

Replies are listed 'Best First'.
Re^4: Print A Sequence with Start codon and different Stop Codon
by Anonymous Monk on Oct 28, 2015 at 12:08 UTC
    should that be "(?{ code })" instead of "(??{ code })" ?

      Nope.

      "(??{ code })" is used so the regex fails and backtracks. It's the backtracking that finds every answer.

        perlre says:
        This is a "postponed" regular subexpression. It behaves in exactly the + same way as a (?{ code }) code block as described above, except that + its return value, rather than being assigned to $^R , is treated as +a pattern, compiled if it's a string (or used as-is if its a qr// obj +ect), then matched as if it were inserted instead of this construct.
        so what is treated as a pattern here? is it what "print $1" returns?