I know that it is easy to match anything except a given character using a regular expression.
$text = \"ab ac ad\"; $text =~ s/[^c]*//g; # Match anything, except
If you just want to check if the string does not contain "ac", just use a negation.
$text = "ab ac ad"; print "ac not found" if $text !~ /ac/;
or
print "ac not found" unless $text =~ /ac/;