in reply to Re^2: Backreference variables in code embedded inside Perl 5.10 regexps
in thread Backreference variables in code embedded inside Perl 5.10 regexps

No good. Fails if any called production uses (?{}).
use strict; use warnings; sub parser { local our @stack; local our @rv; my $parser = qr{ ^ (?&expr) (?&expr) \z (?{ @rv = @stack; }) (?(DEFINE) (?<expr> (?{ [] }) (.) (?{ [ @{ $^R }, $^N ] }) #(?&foo) #(?&bar) (.) (?{ [ @{ $^R }, $^N ] }) (?{ local @stack = ( @stack, join '|', @{ $^R } ); }) ) (?<foo> ) (?<bar> (?{ [] }) ) ) }x; return $_[0] =~ /$parser/ && \@rv; } my $rv = parser('abcd'); print("$_\n") for @$rv;

Works with (?&foo) uncommented but not with (?&bar) uncommented.