Question

Locked

Perl Help

By eightball_20012001 ·
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 = <PASSW&gt {
chomp;
%pass_hash = ('good' => $_ , 'serious' => $_, 'match' => $_ , 'truly' => $_ , 'read' => $_);
@k = keys %pass_hash;
while (<PASSW&gt {
$count{$_}++ for /\w+\b.good|\b.serious|\b.match|.truly|.read/ ;
}
foreach $pass(@k) {
print "The $pass was encountered $count{$_} \n";}

}

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Peripheral Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums