On Thu, 23 Feb 2006 13:02:32 -0500, Uri Guttman wrote:

>  AY> $text =~ s{(
>  AY>              (\b\w+(?:['-]+\w+)*\b)
>
>why the multiple ['-] inside the words? could those chars ever begin or
>end words? so just [\w'-]+ should be fine there.

That reminds me, only earlier today I looked at the word frequency
counter code in perlfaq6.


<http://perldoc.perl.org/perlfaq6.html#How-can-I-print-out-a-word-frequency-or-line-frequency-summary%3f>

I'm a bit puzzled by the comment:

        while ( /(\b[^\W_\d][\w'-]+\b)/g ) {   # misses "`sheep'"
            $seen{$1}++;
        }

I'm wondering why they do it this way...

-- 
        Bart.

Reply via email to