[Israel.pm] count chars

Yuval Kogman nothingmuch at woobling.org
Mon Sep 3 05:36:59 PDT 2007


On Mon, Sep 03, 2007 at 04:53:53 -0700, Yossi Klein wrote:

> sub c_tr {
>     my ($c) = @_;
>     return $string =~ tr/$c/$c/;
> }


Actually:

	tr/$c//;

also works, but of course it's only for characters, not actual
strings.

-- 
  Yuval Kogman <nothingmuch at woobling.org>
http://nothingmuch.woobling.org  0xEBD27418




More information about the Perl mailing list