- publishing free software manuals
Perl Language Reference Manual
by Larry Wall and others
Paperback (6"x9"), 724 pages
ISBN 9781906966027
RRP £29.95 ($39.95)

Sales of this book support The Perl Foundation! Get a printed copy>>>

%LAST_PAREN_MATCH

%+

Similar to @+, the %+ hash allows access to the named capture buffers, should they exist, in the last successful match in the currently active dynamic scope.

For example, $+{foo} is equivalent to $1 after the following match:

'foo' =~ /(?<foo>foo)/;

The keys of the %+ hash list only the names of buffers that have captured (and that are thus associated to defined values).

The underlying behaviour of %+ is provided by the Tie::Hash::NamedCapture module.

Note: %- and %+ are tied views into a common internal hash associated with the last successful regular expression. Therefore mixing iterative access to them via each may have unpredictable results. Likewise, if the last successful match changes, then the results may be surprising.

ISBN 9781906966027Perl Language Reference ManualSee the print edition