johngg has asked for the wisdom of the Perl Monks concerning the following question:
Original regular expression, no warning generated
$rxNumberGrps = qr {(?x) \D* (\d+) (?=,|\)) (?{$deCommafied .= $^N}) (?: (??{$rxNumberGrps}) | \)\z ) };
With offending comment added, warning generated
$rxNumberGrps = qr {(?x) \D* (\d+) (?=,|\)) # append capture to $deCommafied (?{$deCommafied .= $^N}) (?: (??{$rxNumberGrps}) | \)\z ) };
escape sigil, no warning generated
$rxNumberGrps = qr {(?x) \D* (\d+) (?=,|\)) # append capture to \$deCommafied (?{$deCommafied .= $^N}) (?: (??{$rxNumberGrps}) | \)\z ) };
use (?# ... ) style comment, no warning generated
$rxNumberGrps = qr {(?x) \D* (\d+) (?=,|\)) (?# append capture to $deCommafied) (?{$deCommafied .= $^N}) (?: (??{$rxNumberGrps}) | \)\z ) };
Other than the warning being generated, there was no effect on the running of the script and the same output was produced each run. It looks to me like the extended syntax comments aren't stopping the interpolation of variables in some way or another. Is this some sort of bug or am I missing something?
Cheers,
JohnGG
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A variable name in a regex comment triggers a warning
by ysth (Canon) on Dec 24, 2006 at 22:39 UTC | |
by johngg (Canon) on Dec 24, 2006 at 23:10 UTC | |
by shmem (Chancellor) on Dec 25, 2006 at 00:27 UTC | |
by johngg (Canon) on Dec 25, 2006 at 01:30 UTC | |
by johngg (Canon) on Dec 25, 2006 at 13:25 UTC | |
|
Re: A variable name in a regex comment triggers a warning
by mrborisguy (Hermit) on Dec 24, 2006 at 22:39 UTC | |
by imp (Priest) on Dec 25, 2006 at 00:44 UTC | |
by ysth (Canon) on Dec 24, 2006 at 22:41 UTC |