Depends on what you mean by "get help" -- if you mean 'do it for you,' hire a programer. If you mean help fix your code, you'll have to show it to us, and not just say "it did not work."

But if you mean 'get help learning how to....' -- well, http://www.perlmonks.com/index.pl?node=Tutorials#Pattern-Matching-Regular-Expressions-and-Parsing is just awaiting your visit.

And in that same vein, I'm not clear what you $text looks like, coming out of the database, so can't even guess why the snippet you show does "not work."

However, another and better option might be to stick the text into the db with html markup...

<p>para 1</p> <p>Slightly more extensive para two:</p> <ol><li>with details</li> <li>with details</li> </ol> <p>Pare 3 loret ipsum etc....</p>

That:

para 1

Slightly more extensive para two:

  1. with details
  2. with details

Pare 3 loret ipsum etc....

combined with whatever escaping demanded by your code, should do the job.

BTW, re the first reply, above, <br /> is NOT para code as the node might seem to suggest. It's an entity which produces a single linebreak (like 0d, 0a in a windows file) but not a para break which puts in an extra linebreak so paras are separated by a line blank except for the newline.


check Ln42!


In reply to Re^3: I need help with displaying newline or paragraph using perl on my website by ww
in thread I need help with displaying newline or paragraph using perl on my website by 5plit_func

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.