http://www.perlmonks.org?node_id=967948


in reply to totally lost

Precedence. You're matching badinput against the negation of $input. Use:
if ($input !~ /badinput/) { ... }
instead.

Or

if (!($input =~ /badinput/)) { ... }
but that's more typing, and less idiomatic.