in reply to Re^3: (??{ code }) versus (?PARNO) for recursive regular expressions
in thread (??{ code }) versus (?PARNO) for recursive regular expressions
Now I'm definitely going down the old memory train. When I first used the (??{ code }) feature, we had to declare our globals using vars.
use vars qw($x_re); $x = qr/... (??{ $x }) .../
This of course worked, but we were quite excited when they released our with perl561delta. Near that point in time, the following did work as desired without throwing errors:
use strict; our $x = qr/... (??{ $x }) .../
The thing as, as I understand the documentation of perlre, it should be allowed
This is a "postponed" regular subexpression. The code is evaluated at run time, at the moment this subexpression may match.
The whole point of being able to do a recursive regular expression is that you can include the qr// regex that you're currently defining. However, given the choices you listed above, I'd probably go with the following even if it does feel messy
our $x = qr/... (??{ our $x }) .../
Anyway, putting all that aside, I'd still like to get back to my primary question. Is this a feature that I should keep in my toolkit, or should I just drop it in favor of (?PARNO)? I can't think of any situation currently where I'd need the former over the latter, but I would like to know if y'all would consider still using it or not.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: (??{ code }) versus (?PARNO) for recursive regular expressions
by ikegami (Patriarch) on Mar 25, 2011 at 23:46 UTC | |
by wind (Priest) on Mar 26, 2011 at 00:45 UTC | |
by ikegami (Patriarch) on Mar 26, 2011 at 02:49 UTC | |
by wind (Priest) on Mar 26, 2011 at 03:32 UTC | |
by ikegami (Patriarch) on Mar 26, 2011 at 03:48 UTC |