in reply to Backref in a regex quantifier
I can't tell you why the backref doesn't work in a quantifier... but you could use the "postponed regex" construct (??{ code }):
my ($n, $v) = "3 aaa " =~ /^(\d+?) ((??{".{$1}"})) /; print "n=$n, v=$v\n"; # prints "n=3, v=aaa"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Backref in a regex quantifier
by Anonymous Monk on Jul 09, 2007 at 19:58 UTC |