in reply to How to replace '$' in strings
To avoid some of the backslash confusion you can use the \xnn hexadecimal ordinal and a look-ahead.
$ perl -Mstrict -Mwarnings -E ' my $str = q{i am us$ing moni$ka expressi$on}; say $str; $str =~ s{(?=\$)}{\x5c}g; say $str;' i am us$ing moni$ka expressi$on i am us\$ing moni\$ka expressi\$on $
I hope this is helpful.
Cheers,
JohnGG
|
|---|