You are viewing the version of this documentation from Perl 5.38.2. View the latest version
${^PREMATCH}

It is only guaranteed to return a defined value when the pattern was executed with the /p modifier.

This is similar to $` ($PREMATCH) except that to use it you must use the /p modifier when executing the pattern, and it does not incur and performance penalty associated with that variable.

See "Performance issues" above.

This variable was added in Perl v5.10.0.

This variable is read-only, and its value is dynamically scoped.