Short question: What\'s mean the
keys %+
in perl?
I saw it in some source code.
Whenever you see a groovy-looking variable, look it up in perldoc perlvar.
In this case, %+
is the hash that stores the values corresponding to the named captures of the last regex:
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)/;
See perldoc perlretut for more details.