[PerlChina] 请问如何统计字符串中某个条件出现的次数

潘建锋 panjianfeng1979 at gmail.com
Fri Aug 4 00:57:01 PDT 2006


谢谢你了,没有专门的函数吗?

2006/8/4, fayland <fayland at gmail.com>:
>
> 潘建锋 wrote:
> > 比如:/sts3c_au4-j=[1..64]/vt2_tu12-k=[1..3]-l=[1..7]-m=[1..3]
> > 中"="出现的次数。
> > 谢谢!
>
> my $a = '/sts3c_au4-j=[1..64]/vt2_tu12-k=[1..3]-l=[1..7]-m=[1..3]';
>
> my $i;
> $i++ while ($a =~ /=/g);
>
> print $i;
>
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > China-pm mailing list
> > China-pm at pm.org
> > http://mail.pm.org/mailman/listinfo/china-pm
>
>
> --
> Fayland Lam // http://www.fayland.org/
>
> _______________________________________________
> China-pm mailing list
> China-pm at pm.org
> http://mail.pm.org/mailman/listinfo/china-pm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/china-pm/attachments/20060804/e7ed0a79/attachment.html 


More information about the China-pm mailing list