[Mimedefang] Code fragment works only sometimes

Michael Sims michaels at crye-leike.com
Tue Jul 15 00:09:00 EDT 2003


Quoting alan premselaar <alien at 12inch.com>:
 
>         if ($line =~ /$blk/i) {
>             #do stuff here
>         }

He might want to run $blk through quotemeta in case it contains regex
metacharacters.  Probably won't come up, but you never know...

my $quotedBlk = quotemeta $blk;
if ($line =~ /$quotedBlk/i) {
  #do stuff
}

> there may even be an lcase() function

It's "lc":

if (rindex(lc $line, lc $blk) != -1)

___________________________________________
Michael Sims
Project Analyst - Information Technology
Crye-Leike Realtors
Office: (901)758-5648  Pager: (901)769-3722
___________________________________________



More information about the MIMEDefang mailing list