in reply to Re: Re: Trying to count the captures in a compiled regular expression
in thread Trying to count the captures in a compiled regular expression
Also, note that you have to add a () set and then subtract it from the count to be able to distinguish between 0 captures and 1 capture.$regex = qr:(??{print "look ma, no rm -rf /\n"}):; $captures = (() = ""=~/(|$regex)/) - 1;
|
|---|