This is discussed at length in the Perl Cookbook, 2nd edition, recipe 6.18.
As to why, it is common for a program to accept a pattern as one of its arguments; in that case you cannot use $_ !~ /bar/ but must instead resort to:
/^(?:(?!bar).)*$/s
In reply to Re: positive regex for inverted match
by eyepopslikeamosquito
in thread positive regex for inverted match
by kgimpel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |