if (!($str =~ /^FOO$/)) { //do something for no match }