regnames#
Returns the names of the named capture groups of the last successful match.
Synopsis#
use re qw(regnames);
"ab" =~ /(?<a>a)|(?<b>x)/;
my @used = regnames(); # ('a')
my @all = regnames(1); # ('a', 'b')
Without an argument, or with a false one, only the names of groups that took part in the match are returned. With a true argument, every name the pattern defines is returned, matched or not. The order of the names is not defined; sort them if it matters.