$s = '\n'; # note that's 2 chars, not a newline "\n" =~ /$s/; # matches