CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [Zhris] File Comparison (2 files): Matching Occurences: Edit Log



ewh006
New User

Feb 27, 2018, 12:35 PM


Views: 9273
Re: [Zhris] File Comparison (2 files): Matching Occurences

I've gained a little knowledge through you and Bill's post, appreciate it. I still have not came up with a solution however.

My main problem is comparing the two files and matching the KEYWORDS vs. instances of those keywords found in the EMAIL.

What I have right now is counting instances but only within that one file (EMAIL). How do I make it take the email and compare it to matches within the KEYWORDS file?


Code
#!/usr/bin/perl 
#use strict;
#use warnings;
#use autodie;

#####################################################################################################################

#Read Phishing Terms Into Array

$phishing_terms = 'C:\Users\HOUSTONE\Desktop\Perl\10X-PHISHING-TERMS.txt';
open INFILE, "$phishing_terms";
@phish_data = <INFILE>;
close INFILE ;

#####################################################################################################################

#Read EMAIL Into Array

$sample_email = 'C:\Users\HOUSTONE\DESKTOP\Perl\Sample_Email.txt';
open INFILE, "$sample_email";
@email_data = <INFILE>;
close INFILE;

#####################################################################################################################

#Matching Keywords

my @strings = @email_data;

my %count;

foreach my $str (@strings) {
$count{$str}++;
}

foreach my $str (sort keys %count) {
printf "%-31s %s\n", $str, $count{$str};
}



#####################################################################################################################



(This post was edited by ewh006 on Feb 27, 2018, 12:38 PM)


Edit Log:
Post edited by ewh006 (New User) on Feb 27, 2018, 12:38 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives