in reply to Re: Test for newline
in thread Test for newline

This is not exactly the right thing, as /^\n$/ matches both "\n" and "\n\n". Use \z rather than $, or, better, use eq.