Re: Count special character

2005-05-24 Thread Jeff 'japhy' Pinyan
On May 24, Joel Divekar said: #!/usr/bin/perl -w my $a = "a:b:c:d:e:f:\:↔:↔:"; my $count = ($a =~ tr/\chr(29)//); That doesn't work. First of all, '↔' in Perl is just 7 characters in a row. HTML entity codes are for HTML, not Perl. If you want character #8596 in Perl, you have to use ch

Count special character

2005-05-24 Thread Joel Divekar
Hi All I want to search a string for a special character and count the occurance. My code is as follows : -- #!/usr/bin/perl -w my $a = "a:b:c:d:e:f:\:↔:↔:"; my $count = ($a =~ tr/\chr(29)//); print $count; -- Following code