in reply to I need help with displaying newline or paragraph using perl on my website

My problem here is when i retrieve the data from the database and display it using Perl there are no newlines displayed on the page the text is all joined together.

Newlines -- as represented by \n -- are considered whitespace like any other in HTML and rendered as such, rather than as actual newlines (outside of tags such as <pre> and <code>, anyway). You need to turn them into <br> tags:

$text =~ s#\n#<br>#g;

These'll indicate that the browser should render linebreaks.

  • Comment on Re: I need help with displaying newline or paragraph using perl on my website
  • Download Code