On 04/09/07, Gaal Yahas <[EMAIL PROTECTED]> wrote:
> On 9/3/07, Amir E. Aharoni <[EMAIL PROTECTED]> wrote:
> > What is the best way to count the number of times that a character
> > appears in a string?
> > Is there a way to do it without the intermediate array?
>
> Yes.
>
> my $count = () = $string =~ /a/g;

Yep - someone already mentioned the goatse oprator. (It took me a
second to understand the goatse connection...)

But did anyone notice the weird performance problem i posted earlier?..
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to