in reply to Using Regexp Patterns as Variables
This smells a little XY Problem to me since I can't see why you'd want to do that.
That said, what's happening here is that the value of $1 is interpolated into $out at the time that you define $out. If you want, you can use single quotes to define out, and it will have the literal string "$1" in it, but that won't work either.
You may be able to do this:
my $out = '/s/Products/$1'; $ENV{REQUEST_URI} =~ s/$in/eval qq{"$out"}/ie;
I can't say I recommend that, however, especially if you don't trust the source of your real $out.
So what problem are you really trying to solve? What lead you to write code like this in the first place?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using Regexp Patterns as Variables
by ikegami (Patriarch) on Mar 18, 2009 at 16:39 UTC | |
by Rodster001 (Pilgrim) on Mar 18, 2009 at 16:51 UTC | |
by Anonymous Monk on Mar 18, 2009 at 17:49 UTC | |
by kyle (Abbot) on Mar 18, 2009 at 16:48 UTC | |
by ikegami (Patriarch) on Mar 18, 2009 at 16:56 UTC | |
by Rodster001 (Pilgrim) on Mar 18, 2009 at 17:06 UTC | |
|
Re^2: Using Regexp Patterns as Variables
by Rodster001 (Pilgrim) on Mar 18, 2009 at 16:23 UTC | |
|
Re^2: Using Regexp Patterns as Variables
by Rodster001 (Pilgrim) on Mar 18, 2009 at 17:01 UTC | |
by kyle (Abbot) on Mar 18, 2009 at 17:08 UTC | |
by Rodster001 (Pilgrim) on Mar 18, 2009 at 17:26 UTC | |
by kyle (Abbot) on Mar 18, 2009 at 18:09 UTC | |
by ikegami (Patriarch) on Mar 18, 2009 at 19:45 UTC | |
|