I want to replace '$' in the string. I tries s/// in so many ways. But not working properly. Finally I got this one. Is there any other simple ways to do it???
#!/usr/bin/perl use strict; use warnings; my $string = 'i am us$ing moni$ka expressi$on'; my @array = (split /\$/,$string); my $flag = 0; my $line = ""; foreach my $element (@array) { if ($flag == 0) { $line = $element; $flag =1; } else { $line = $line.'\$'.$element; } } print $line;
In reply to How to replace '$' in strings by ravi45722
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |