Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Help to improve script that searches a file for key words in a second file.

by jwkrahn (Monsignor)
on Mar 29, 2013 at 16:51 UTC ( #1026172=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
            if($annotation =~ /(\b($term)\b|$term-)\b|(-$term)\b/i) {
                $nTermHits {$term}++;
                $nTotalHits++;
                push(@annotationlist, "$annotation\n");
        }
    
  2. or download this
            if($annotation =~ /(?:\b$term|$term-|-$term)\b/i) {
    
  3. or download this
    foreach $term (@terms) {
        if ($nTermHits {$term} > 0) {
            printf "%s\t%d\n", $term, $nTermHits {$term};
        }
    }
    
  4. or download this
    foreach $term (keys %nTermHits) {
        printf "%s\t%d\n", $term, $nTermHits {$term};
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026172]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-04-18 06:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (462 votes), past polls