On Mon, Aug 28, 2000 at 12:23:48PM -0600, Tom Christiansen wrote:
> >Have you ever wanted to count the number of matches of a patten?  s///g 
> >returns the number of matches it finds.  m//g just returns 1 for matching.
> >Counts can be made using s//$&/g but this is wastefull, or by putting some 
> >counting loop round a m//g.  But this all seams rather messy. 
> 
> It's really much easier than all that:
> 
>     $count = () = $string =~ /pattern/g;

Which I find cute as a demonstration of the Perl's context concept,
but ugly as hell from usability viewpoint.  I how to assign to an
empty list to get a number of something?  Hello?  This harks back to
the dirty (similarly cute, but still dirty) (c(a(s(t)))) games of C.
It may be an idiom but it still doesn't sing to me.

-- 
$jhi++; # http://www.iki.fi/jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Reply via email to