******** Counting exact word from file ***********
open (f2,"abc.txt");
while (<f2>)
{ push(@w,split(/\W+/, $_));}
close f2;
foreach (@w)
{ if ($_ eq "search")
{$c++;}
}
print "\n Total count of "searched" word is $c\n";
Originally posted as a Categorized Answer.
Comment on Re: How do I count the frequency of words in a file and save them for later?