in reply to Writing a negative regex using =~

my( $flag, $regex ) = /(\s*(\!))?(.*)/; $flag ? text !~ $regex : $text =~ $regex