my @l = qw(foo bar baz quux); foreach (@l) { if(index($_, 'a') > -1) { next; } else { print $_, $/; } } __output__ foo quux #### &do_something foreach grep { (! conditionA) && conditionB } @tmp;