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 chr(8596) or a hex sequence like
\x{2194}. Next, tr/// doesn't know what "\chr(29)" means. tr/// just
takes normal characters, octal or hex escape sequences, and ranges (two
characters with a - between them).
my $count = ($a =~ tr/\x{2194}//);
works.
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ % -- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>