If I understand the documentation, you can remove eval from there, as it's useless for qr{}.
Well, as far as I can tell, the code the OP posted doesn't make use of the eval feature at all , the code section is a literal
literal
$ perl -E " $_ = 123; m/\d(?{ warn pos })/" 1 at (re_eval 5) line 1. $ perl -E " no re qw/eval/; $_ = 123; m/\d(?{ warn pos })/" 1 at (re_eval 5) line 1. $ perl -E " $_ = 123; $f = qr/\d(?{ warn pos })/; m/$f/;" 1 at (re_eval 5) line 1. $ perl -E " no re qw/eval/; $_ = 123; $f = qr/\d(?{ warn pos })/; m/$f +/;" 1 at (re_eval 5) line 1.
variable aka "dynamic" aka it throws error :)
$ perl -E " $_ = 123; $f = '(?{ warn pos })'; m/\d$f/; " Eval-group not allowed at runtime, use re 'eval' in regex m/\d(?{ warn + pos })/ at -e line 1. $ perl -E " $_ = 123; $f = '(?{ warn pos })'; $g = qr/\d$f/; m/$g/" Eval-group not allowed at runtime, use re 'eval' in regex m/\d(?{ warn + pos })/ at -e line 1.
I believe whatever the OPs real code, he got this error message so he added the "solution"
I also believe there is no need for any of this stuff :) if all the OP is doing is building a data structure, simply match in a loop and use %+ or use Regexp::Grammars
In reply to Re^2: Question on Regular Expression
by Anonymous Monk
in thread Question on Regular Expression
by sjain
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |