in reply to How to handle new lines in textfield (CGI)

Here is a possible reason, as most everything looks good to me:

use warnings or -w switch might have told you that "my" variable $address masks earlier declaration in same scope. change:

my $address =~ s/\n/<br>/g;
to:
$address =~ s/\n/<br>/g;
and your problem *should* be solved.