"foo\nbar" =~ /foo$/ or print "Didn't match EOL :-(\n"; #### ^ begin $ end (before \n) #### ^ start of str $ end of str (incl \n) #### /m ^ = SOL, $ = EOL /s . matches \n too