use re qw(debug); ( "hello Gags" =~ /^(?=hello).*[^G][^a].*$/ )&& print ("Matched") || print ("Unmatched");