You are viewing the version of this documentation from Perl 5.34.1. View the latest version

The text matched by the highest used capture group of the last successful search pattern. It is logically equivalent to the highest numbered capture variable ($1, $2, ...) which has a defined value.

This is useful if you don't know which one of a set of alternative patterns matched. For example:

/Version: (.*)|Revision: (.*)/ && ($rev = $+);

This variable is read-only and dynamically-scoped.

Mnemonic: be positive and forward looking.