in reply to Word frequency in an array

Hang on, I figured it out.

@fool = grep (/foo/, @array);

FWIW you may rewrite that as

@fool = "@array" =~ /foo/g;

But I suspect you really want

my $fool = grep $_ eq 'foo', @array;