[Mimedefang] Code fragment works only sometimes

Jeffrey Culverhouse jafoc at rev.net
Mon Jul 14 17:13:01 EDT 2003


On Mon, 14 Jul 2003 22:16:22 EST
Andrea Venturoli <ml.ventu at flashnet.it> wrote:

> Ok, I've tried these two. Since I'm not a perl guru, I've reported my code
> once again. Could you please give it another look?
> 
>     if
>     (open(HDR,"HEADERS")&&open(BLK,"/usr/local/netfence/local/etc/spam_re
>     cipients")){
>         my(@lines)=<HDR>; my(@blk)=<BLK>;
>         close(HDR); close(BLK);
>         foreach $line (@lines)
>         {
>             foreach $blk (@blk)
>             {
>                 if (rindex($line,$blk)!=-1)
>                 {
>                     md_log($line);
>                     return action_bounce("Spam is not accepted");
>                 }
>             }
>         }
>     }


You could try (I think), for the loop

         foreach $line (@lines)
         {
             if (grep ($_ =~ $line, @blk))
             {
                   md_log($line);
                   return action_bounce("Spam is not accepted");
             }
         }






-- 
"It is not so much that I have confidence in scientists being right,
but that I have so much in nonscientists being wrong..."
  Isaac Asimov (from 1977 essay "Asimov's Corollary,"
    reprinted in Quasar, Quasar, Burning Bright, 1977)

Jeff Culverhouse * jeff at rev.net
VP Operations, Rev.Net Technologies, Inc.
V 540.772.3282 F 540.772.0573



More information about the MIMEDefang mailing list