in reply to replace multiple dollar instances ($) in a string
If you're just trying to delete single characters, a more appropriate tool would be tr with the /d option (delete). $s1 =~ tr/$&//d;
Edit: tr is a slightly better tool in that case because, beyond being faster, characters in the left part don't have a special meanings, so $ and & just mean $ and &; not the $& variable, or the end of the string (for $). There's no escaping needed.
Corrected typo, it's /d not /g. Thanks AnomalousMonk & kcott
|
|---|