in reply to Strange regex to test for newlines: /.*\z/
http://perldoc.perl.org/perlre.html "To match the actual end of the string and not ignore an optional trailing newline, use \z ."