What's the easiest way to go through the contents of a multiline text box and append "<br>" (without the quotes) to the end of each line?

It's part of a cgi program that lets the user open a text file and send it to the browser as a web page.