[Mimedefang] Adding bayes_score from Mail::SpamAssassin:EvalTests
Kelson Vibber
kelson at speed.net
Tue Dec 16 15:42:47 EST 2003
At 11:59 AM 12/16/2003, Brett Simpson wrote:
>Here's what I did but I get an error.
>
> if ($names ne /BAYES_99/) {
> $bayes_score = $1;
Two problems. First, you're mixing regular expression syntax and literal
comparisons on the first line. You want to use =~ or !~ instead of
ne. Secondly, you're not matching anything (something needs to be in
parentheses), so there's nothing in $1 to assign to $bayes_score.
Try something like this:
if ($names =~ /\bBAYES_([0-9][0-9])\b/ && $1 ne '99') {
$bayes_score = $1;
This will look for any whole words that consist of BAYES_XX where XX is a
pair of numbers, and store the XX into $1, then only continue if those
numbers are not 99.
If you want something more readable but less efficient, you might try
if ( $names !~ /BAYES_99/ ) {
if ($names =~ /BAYES_([0-9][0-9])/) {
$bayes_score = $1;
Kelson Vibber
SpeedGate Communications <www.speed.net>
More information about the MIMEDefang
mailing list