in reply to Word frequency in an array
What is the best way to count how many times the word "foo" occurs in @array?If you only want to count occurances, use grep in scalar context
my $count_foo = grep (/foo/, @array);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Word frequency in an array
by McDarren (Abbot) on Jun 10, 2007 at 16:33 UTC |