in reply to Re^5: How to know that a regexp matched, and get its capture groups?
in thread How to know that a regexp matched, and get its capture groups?

If you want ${^MATCH} to work in pre-5.20, you need to use /p, which imposes the performance penalty only on the marked regex. On 5.20+, /p is a noop and ${^MATCH} works always, plus all the performance penalties are gone (not tested by me).

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
  • Comment on Re^6: How to know that a regexp matched, and get its capture groups?
  • Download Code