perl -wle ' my @test = qw(FOO FOOBAR FOO AFOO FOO BARFOO FOOFOO FOO1); print "match: $_" for grep { /^(?!FOO$)/ } @test; ' match: FOOBAR match: AFOO match: BARFOO match: FOOFOO match: FOO1