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
In reply to Re: How to replace '$' in strings
by johngg
in thread How to replace '$' in strings
by ravi45722
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |