my %phrase = ( '^In-Reply-To:' => -1000, 'FREE' => 1000, 'YOU' => 800, '\b[A-Z]+\b' => 40, '!{3,}' => 800, 'money' => 499, 'MONEY' => 999, 'remove' => 50, 'unsubscribe' => 200, #'AOL' => 999, 'e.+business' => 50, ); while ($FILE = shift @ARGV) { $points = 0; open (FILE, $FILE); while () { foreach $key (keys(%phrase)) { if ($_ =~ /$key/) { $points += $phrase{$key}; } } } #print "$FILE ".$points."\n"; if ($points > 1000) { print "YES\n" }else {print "NO\n"; } }