I'm trying to modify a vendor's perl script to evaluate whether a string exists in the current element from an array, after first evaluating whether another string exists in the same (I think) element.
I want to look for "Forward to|Redirect to|Mirror to" and if exists then look for "Discard". Right now their code looks for "Discard" whether or not the previous strings exist or not.
sub processAccount {
my $account=$_[0];
my $Rules=$cli->GetAccountMailRules($account);
  foreach my $Rule (@$Rules) {
    my $actions=$Rule->[3];
    foreach my $actn (@$actions) {
      my $a=$actn->[0];
      if($a=~/Forward to|Redirect to|Mirror to/) {
        print "$account: '$a' -> $actn->[1]\n";
      } 
      if($a=~/Discard/) {
        print "$account: Discard\n";
      }
    }
  }
I've tried nesting the if loop looking for "Discard", but it never evaluates as true.
foreach my $actn (@$actions) {
  my $a=$actn->[0];
  if($a=~/Forward to|Redirect to|Mirror to/) {
    print "$account: '$a' -> $actn->[1]\n";
    if($a=~/Discard/) {
      print "$account: Discard\n";
     }
   }
 }