# New Ticket Created by Sam S. # Please include the string: [perl #121070] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=121070 > I've been experimenting with using embedded (?{...}) blocks in regexes that also make use of the (?&NAME) "Recurse to a named subpattern" feature, and found that for many such regexes, the embedded code blocks fail to take effect when they should. Here's a simple test case that demonstrates the bug: use Data::Dumper; "abcd" =~ /(?&Char) (?{ 42 }) (?(DEFINE) (?<Char> . ) )/x; print Dumper $&, $^R; Output: $VAR1 = 'a'; $VAR2 = undef; Expected output: 42 instead of undef Curiously, the above test case suddenly *does* work when a superfluous {1,1} is added to the regex like so: "abcd" =~ /(?&Char){1,1} (?{ 42 }) (?(DEFINE) (?<Char> . ) )/x; The output is now: $VAR1 = 'a'; $VAR2 = 42; This is just one example of how fragile & unpredictable the combination of these two regexp features seems to be; Many cases don't work, although some do. --- PS: I'm using Perl 5.18.2 on Arch Linux, installed using the official distro-provided packages. Output of "perlbug -d" is attached.Thread Next