GrandFather, minor quibble. Take the output section and change it to:
And notice it stop working. Well, notice it give the last result for all the matches. Now change your code to return { %mv } if keys %mv != 0 and notice it start working again.my @results = map { [$_ => domatch($_, $r)] } @strings; #foreach my $str (@strings) { foreach my $r (@results) { my ($str, $result) = @$r; print "Matching on $str\n"; #my $result = domatch($str,$r); if ($result) { print "Result:\n"; foreach my $k (keys %{$result}) { print "\t$k => $result->{$k}\n"; } } else { print "No match.\n"; } }
It is bizarre ... and I'm hoping someone more familiar with the regexp engine internals will pipe up as to why this isn't DWIMming very well. I tried a number of different changes to try to get the engine to think I was doing another match, but failed, perhaps someone else will see what we're missing. In this way, I wouldn't (yet) call what you did a "fix" but more of a "workaround" ;-)
In reply to Re^2: regex eval capture weirdness
by Tanktalus
in thread regex eval capture weirdness
by bytex64
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |