Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^6: Turning on regexp debugging at runtime

by RonW (Parson)
on Sep 24, 2014 at 16:35 UTC ( #1101828=note: print w/replies, xml ) Need Help??

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 (Bishop) 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.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1101828]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2019-11-19 07:36 GMT
Find Nodes?
    Voting Booth?
    Strict and warnings: which comes first?

    Results (94 votes). Check out past polls.