Eric Waguespack wrote:
I am sure someone else can do it better, but how about the following?

foreach (@rray){
  if (/match/) {print "yay";}
}

Thanks, this will work for printing as you suggest. What I'm trying to do is replace this:
================================================================
my $checkThisMessage = $name . $company . $email . $telephone . $comment;
        if( ! (
                ($email eq '') or
                ($checkThisMessage =~ m/abc123/i) or
                ($checkThisMessage =~ m/00000/) or
                ($checkThisMessage =~ m/ringtones/i) or
                ($checkThisMessage =~ m/dresses/i) or
                ($checkThisMessage =~ m/handbags/i) or
                ($checkThisMessage =~ m/phentermine/i)
        ) ) {
        
        $msg->send
=================================================================

We have webforms for our customers and we're getting spammed. I'd like to put all the phrases into an array instead of all of this 'or' business.



On 10/10/06, Charles Farinella <[EMAIL PROTECTED]> wrote:
How can I iterate through an array and if I find a match do something
without doing that thing for every element in the array.  I've been
trying to do it with foreach, but that isn't working.

--
------------------------------------------------------------------------
Charles Farinella
Appropriate Solutions, Inc. (www.AppropriateSolutions.com)
[EMAIL PROTECTED]
voice: 603.924.6079   fax: 603.924.8668


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>






--
------------------------------------------------------------------------
Charles Farinella
Appropriate Solutions, Inc. (www.AppropriateSolutions.com)
[EMAIL PROTECTED]
voice: 603.924.6079   fax: 603.924.8668


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to