in reply to Re^5: Turning on regexp debugging at runtime
in thread Turning on regexp debugging at runtime

Try this:

{ use re debug; my $re = qr/myregex/; } ... if ($item =~ /$re/) { ... }

Update: SBECK had said:

Unfortunately, the "use regexp" pragma is applied when the regexp is created... I want something to turn debugging on when a regexp is matched against.

so I tried to make a helpful suggestion.

Sorry it was not helpful

Replies are listed 'Best First'.
Re^7: Turning on regexp debugging at runtime
by choroba (Cardinal) on Sep 24, 2014 at 17:03 UTC
    Try it yourself. $re will be scoped only inside the block, so can't be used outside the curly brackets in the if.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ