in reply to Re^2: /e in regexes
in thread /e in regexes
In one case, you want the replacement expression to be a Perl expression,
In the other, you want the value of $1 to be evaluated.
# s/(10)/$1+1/e $dollar1 = "10"; $replace = $dollar1 + 1; # One 'e', so Perl expression. print $replace; # 11 # s/(10\+4)/$1/e $dollar1 = "10+4"; $replace = $dollar1; # One 'e', so Perl expression. print $replace; # 10+4 # s/(10\+4)/$1/ee $dollar1 = "10+4"; $replace = eval $dollar1; # Two 'e', so Perl expression + eval. print $replace; # 14
Update: Oops, this was supposed to be a reply to Re^2: /e in regexes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: /e in regexes
by waldner (Beadle) on Jun 22, 2008 at 17:02 UTC |