It depends on what you mean by "match." If you want the regex to be true for every string except the regex, you can
use the "not bind" operator (my name for it, not the official one) as such:
$string !~ /whatever/
On the other hand, if you want to capture everything that doesn't match, you would have to do something along the lines of
$string =~ /(.*)whatever(.*)/;
with the matches around "whatever" being $1 and $2.
Update: As noted by
Albannach, if you are
looking for exact matches only, you should use
/^whatever$/ instead in the first example. The original version will also match 'This whatever that.' whereas the updated version will only match 'whatever'.
-
HZ