in reply to replace not working as expected
The (...) is being interpreted as a regular expression group. Try:
$inputstring=~s/\Q$t/$r/;
The \Q quotes any special characters following it so they lose their special meaning, so your $t will be matched literally.
For details see quotemeta and perlre.
|
|---|