in reply to Re: Counting the frequency of words in a string
in thread Counting the frequency of words in a string

oh, i guess that could be just

my $count = $text =~ s/$word_regex//g;

(since destroying $text doesn't matter in my case)

  • Comment on Re^2: Counting the frequency of words in a string

Replies are listed 'Best First'.
Re^3: Counting the frequency of words in a string
by Eimi Metamorphoumai (Deacon) on Dec 02, 2004 at 22:26 UTC
    Or
    my $count = () = $text =~ /$word_regex/g;
    The parens make it list context, then you take the scalar context from that.