in reply to deleting characters from a string but the characters are in a variable
$string =~ s/[$oldchars]//g
If you want to replace them:
eval "\$string =~ tr/$oldchars/$newchars/"
In both cases you might need to escape something if there are meta characters, for example with quotemeta for the regex.
|
|---|