I am having some difficulties in handling a string with '$' embeded.
I wrote a piece of perl code to experiment:
And the output is:
Apparently, I would expect $len2 is the same as $len1. But I don't know how to hadnle a string like '$text2'.
The files I got from our clients contain lots of similar stings like '$text2' shown above. Could someone offer me a hand? Many thanks!
I wrote a piece of perl code to experiment:
Code:
my $text1 = "US\$ 4.5";
my $text2 = "US$ 4.5";
my $len1 = length($text1);
my $len2 = length($text2);
print "\$len1 = $len1, \$text1 = $text1\n";
print "\$len2 = $len2, \$text2 = $text2\n";
And the output is:
Code:
% ./mytest.pl
$len1 = 7, $text1 = US$ 4.5
$len2 = 4, $text2 = US.5
Apparently, I would expect $len2 is the same as $len1. But I don't know how to hadnle a string like '$text2'.
The files I got from our clients contain lots of similar stings like '$text2' shown above. Could someone offer me a hand? Many thanks!