$input = "-lalala:lalala- hello"; #if "badinput" isnt in the string then print the string. if (!$input =~ m/badinput/) { print "$input!"; }