Note that there are some explanatory texts on larger screens.

plurals
  1. POPerl - Search array of words to check for a partial match in any part of an email address
    primarykey
    data
    text
    <p>Again, a whole day and I am stuck again.</p> <p>I need to use an array of words or var that contains forbidden words that cannot appear in an email address.</p> <p>Either:</p> <pre><code>$baddies = 'smtp mailer sysop'; </code></pre> <p>or</p> <pre><code>@baddies = qw(smtp mailer sysop); </code></pre> <p>or</p> <pre><code>@baddies = qw/smtp mailer sysop/; </code></pre> <p>There are more bad words in the array too, about two dozen.</p> <p>I am not running the latest version of perl so ~~ and so on are not supported.</p> <p>I have a loop going on that sends the bands schedule out.</p> <p>In that loop I need to check to see if the email contains any of those words. I realize there may be some good emails that contain a match but, that is fine.</p> <p>I have tried literally dozens of examples after I gave up trying to figure it out.</p> <p>Latest was:</p> <pre><code>####FYI## $uaddress is from the foreach $uaddress(@addresses){ loop. my %params = map { $uaddress =&gt; 1 } @baddies; if(exists($params{$uaddress})) { print "yep, it's there"; #for testing push(@failed,"$uaddress is restricted&lt;br /&gt;"); </code></pre> <p>But, everything I tried just does not do what I need.</p> <p>I even tried =~ and so on.</p> <p>I AM REALLY feeling stupid about now..</p> <p>I need another lesson here folks.. Thanks in advance.</p> <p>Update: I also tried:</p> <pre><code>$baddies = 'smtp mailer sysop'; my @baddies = split / /, $baddies; # iterate through the array foreach (@baddies) { if($_ =~ $uaddress) #I also reversed that { print qq~$uaddress contains $_~; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload