in reply to Replacing line returns with br

$text =~ s/\\r\\n/<br>/;
This does not do what you expect of it -- you're escaping the second backslash, not the the carriage return/newline.