1) What is the proper syntax to declare a recursive regular expression using (??{ code })I'd say, the only proper way is to not use it. (??{ }) (and (?{ })) have many problems. Scoping is one of them. (??{ }) is inefficient, not self contained, and in general, a PITA to use. On top of that, they're buggy. And may crash your program:
The reason the constructs are still marked experimental is that noone has stepped up and said "Not only do I know how to fix the issues, but here's a patch". For all we know, noone knows how to fix the issues.$ perl -wE '/(??{ s!!! })/' Use of uninitialized value $_ in substitution (s///) at (re_eval 1) li +ne 1. ... repeated many times ... Segmentation fault $
Does anyone know what version of perl the following started throwing a strictures error our $x = qr/(??{ $x }/ and of course why.Somewhere between 5.8.1 and 5.8.8. And probably due to a bug fix.
Can anyone think of a single instance where (??{ code }) would be used for recursive regular expressions over the (?PARNO) feature, or should that usage be deprecated from one's toolbox?Only if code returns something different - perhaps because parameters are passed. Other than contrived examples, I cannot come up with something where I'd prefer to use such pattern.
In reply to Re: (??{ code }) versus (?PARNO) for recursive regular expressions
by JavaFan
in thread (??{ code }) versus (?PARNO) for recursive regular expressions
by wind
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |