I’ve been doing some searching and haven’t found an answer. Why isn’t this working?
$self->{W_CONTENT} =~ /$regex/;
print $1; #is there a value? YES
$store{URL} =~ s/$param/$1/;
Yes $1 has a value. $param is replaced however it is replaced with nothing. I’m positive $1 has a value. If I replace with text instead of “$1” it works fine. Please help!
For
$1to have a value you need to ensure that$paramhas parentheses()in it. i.e. The following has a problem similar to what you are explaining.But this works
Now if you want to use the
$1from your first regex in the second one you need to copy it. Every regex evaluation resets$1…$&. So you want something like: