http://www.perlmonks.org?node_id=410519


in reply to Replacing new lines in multi line text box form fields with <br>.

Use a character class to deal with LF CR and CRLF line endings. A standard newline after the
maintains readability.
$INPUT{'comments'} =~ s/[\r\n]+/<br>\n/g;