I dont understand exaclty what are you trying to do...
If you want to do a regex over the keys of a hash and
get some part of them using backreferences, then
something like
@p=map /(\w+)/g, keys %nerf;
would work; it takes all keys, get all secuences of
word chars from each key and return the array with all
the parts. Or, for instance, if you want only the values
whose keys match some regex, you could do
@v=map $nerf{$_}, map /^(\d+)$/, keys %nerf;
(this gets all values from %nerf where the key is a number)
Or even, get a new hash with the subset of the previous
hash pairs where the key matches the regex:
%sh=map {($_=>$nerf{$_})} map /^(\d+)$/, keys %nerf;
Now, if what you want is to apply a regex to $_ or other
string, take all the backreferences for it, and then
get the values from the hash whose key its one of those
backreferences, something like
@v=map exists $nerf{$_} ? $nerf{$_} : (), /(\w+)/g;
%sh=map exists $nerf{$_} ? ($_=>$nerf{$_}): (), /(\w+)/g;
(in this case, that gets all words from $_ and gives you
the array of values of the subset of the hash)
Now this is obfuscated, right? :-)