Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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?
[LanX]: auto-subtitles in YT are entertaining: "fuehrer" instead of fewer, "jews" instead of juice ...
Discipulus never noticed there was subtitles... can I call them with &subtitle or is too much perl 4?
[LanX]: YT=youtube
[Discipulus]: ;=) yes i'm not SO dumb
[LanX]: SO=StackOverflow

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2017-06-23 16:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (552 votes). Check out past polls.