http://www.perlmonks.org?node_id=602333


in reply to Re^3: Determing whether a regexp has capturing matches
in thread Determing whether a regexp has capturing matches

Keep in mind that $#+ is -1 when the pattern does not match, regardless of whether there are captures.

Good point. I was just thinking of my context where I'm guaranteed a successful match.

  • Comment on Re^4: Determing whether a regexp has capturing matches