Question Locked

Perl Help

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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";}

}

1 reply

This discussion is closed to new replies.