SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Nov 2002
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    perl form handling - carriage returns

    I have a simple textbox in an html form. I enter in some data on different lines in the textbox by hitting enter to go to the next line. When I display the string (either on the following webpage or writing to an external file), there are no carriage returns, only spaces. How do I create these carriage returns on the webpage or in the external text file? Thanks for checking this out...
    - Jesse

  2. #2
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm guessing that the line breaks are being preserved but they need to be converted from \n or \r to <br> in order for them to show up in a browser.

    Is that it? If so, I'm sure there is a package that can take care of it, or you can use some regex, something like this perhaps:
    /(\n\r)|\n|\r/<br>/
    or maybe this:
    /[^.]/<br>/

    Post back if this helps or not... I haven't been working with Perl much lately so it has been fading from my memory which is a shame since it is so handy.
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •