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

htmanning has asked for the wisdom of the Perl Monks concerning the following question:

Monks, I have a mail form. When it is submitted the $message field contains carriage returns that make it into the database as carriage returns, but when the email gets sent the message field is run together. I'm reading it in with:
$message=$in{'message'};
Then doing one of these. I've tried them all:
$message =~ s/\n/\<br\>/g; $message =~ s/\n/<br>/g; $message =~ s/\n/<br\>/g;
None of them work. The source of the email shows white space between paragraphs, but because it's an HTML email the lines are run together when the user reads it. I need to convert those spaces to <br>. What am I missing?