in reply to Replace new line char with br

$post =~ s/\n/<br>\n/g;

ought to do the job. Or (depending on where you like your <br>'s):

$post =~ s/\n/\n<br>/g;

Note that I'm assuming that you would like to retain the new-lines so the contents of $post remain easily readable. If not, just drop the   \n   on the right side of the substitution.

There may be some folks who will be made nervous by the match on \n. If so, just remember that the infamous   /s   and   /m   qualifiers only affect matches with '.' on the one hand and ^ and $ on the other. \n matches mid-stream new-lines without any help from modifiers.

Update: See my answer to gryphon for the spiffier solution:

      $post =~ s/$/<br>/mg;