in reply to Capturing in interactive replace?
That is: $string1 and $string2 will be interpolated before being passed to eval, and $mystring will not be interpolated. In the example above, eval will see:$string1 = 'sometext(.*)something(.*)'; $string2 = '$1:$2'; $mystring = "sometext--blahblah--something--foobar--"; eval "\$mystring =~ s/$string1/$string2/"; print "$mystring\n";
and that is what will be executed within the eval.$mystring =~ s/sometext(.*)something(.*)/$1:$2/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Capturing in interactive replace?
by zylot (Initiate) on Feb 20, 2008 at 23:56 UTC |