I think my problem is pretty similar to this one: How to use a variable in the replacement side of the Perl substitution operator? The difference is, $find and $replace are the keys and values of a hash i am using.
while(($find,$replace) = each %hash){
$string_to_check =~ s/$find/$replace/e;
}
Here's an example for one pair of key-value-pair in my hash
key: ^/abc(/.*)?$
value: www.abc.website.com$1
I get an substitution here, but the $1 won't be replaced by the content of (/.*)
With s///ee instead of s///e, i get:
Bareword found where operator expected at (eval 1) line 1, near "//xyz"
(Missing operator before xyz?)
Use of uninitialized value in substitution iterator at ./script line 46, <FH1> line 3470.
...and therefore the matching parts are replaced with an empty string.
I am assuming, that
while(($find,$replace) = each %hash)
won't do the same as the single quotes in the first answer to the other question in the thread i linked to:
$replace='"foo $foo bar"';
Is that right?
Excuse my English and Thanks for your help in advance. (I am new to Perl and Programming in general.)