my $str = 'abc'; my $pat = 'c'; say $str =~ /$pat/? 'match': 'mismatch'; say $str =~ /(?!$pat)/? 'match': 'mismatch'; __END__ match match