I am trying to write a perl script that will read a document and count the occurrence of specific words through a hash. With what I have, I can get it to print out each word “word was found ”
But i cannot get a value after found. Please help.
open (PASSW,’<', 'ready.txt');
@k = /\w+\b.good|\b.serious|\b.match|.truly|.read/;
while (@k =
chomp;
%pass_hash = (‘good’ => $_ , ‘serious’ => $_, ‘match’ => $_ , ‘truly’ => $_ , ‘read’ => $_);
@k = keys %pass_hash;
while (
$count{$_}++ for /\w+\b.good|\b.serious|\b.match|.truly|.read/ ;
}
foreach $pass(@k) {
print “The $pass was encountered $count{$_} \n”;}
}