Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I have a form that is using the POST method to add to a flat file database.

The parse subroutine uses the following lines:

$name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
I am having trouble because the output has far too many "returns" placed in it.

I am previewing the output prior to adding to the database by placing the values into another form. But, the "returns" (\n) are continually multiplied with each preview/modify so that what is finally printed into the flatfile has far to much space between what should only be paragraphs.

I placed print statements before and after the above lines and here is the output:

BEFORE:

Nautical+Inn+Resort%2C+located+on+Placencia+Peninsula%2C+Belize%2C+offers+beach+accommodations%2C+great+dining%2C+SCUBA+diving%2C+snorkeling%2C+Jaguar+Reserve%2C+Monkey+River%2C+Maya+Ruins+plus+the+culture+of+Garifuna+drummers+and+dancers+all+rolled+into+an+exciting+Belize+vacation.+You%27ll+find+us+where+the+Caribbean+meets+the+jungle%21+%0D%0A%0D%0A%3CP%3E%0D%0A%0D%0ANautical+Inn+occupies+4+acres+on+Placencia+Peninsula.+Twelve+beach+front+rooms+have+air+conditioning%2C+ceiling+fans%2C+modern+bathrooms+and+great+beds.+Mahogany+and+wicker+furniture+are+accented+with+a+nautical+theme.+The+Oar+House+is+the+place+for+fine+dining+and+Caribbean+cocktails.+The+daily+activity+board+lists+tours+and+excursions+to+help+you+see+Belize+from+the+reef+to+the+rainforest.

AFTER:

Nautical Inn Resort, located on Placencia Peninsula, Belize, offers be +ach accommodations, great dining, SCUBA diving, snorkeling, Jaguar Re +serve, Monkey River, Maya Ruins plus the culture of Garifuna drummers + and dancers all rolled into an exciting Belize vacation. You'll find + us where the Caribbean meets the jungle! Nautical Inn occupies 4 acres on Placencia Peninsula. Twelve beach fro +nt rooms have air conditioning, ceiling fans, modern bathrooms and gr +eat beds. Mahogany and wicker furniture are accented with a nautical +theme. The Oar House is the place for fine dining and Caribbean cockt +ails. The daily activity board lists tours and excursions to help you + see Belize from the reef to the rainforest.

Now, when I submit the preview form, the space between paragraphs is doubled. And if I use a modify form, the space is again doubled.

Can you explain what is going on?


In reply to problem with extra lines when using by belize

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (2)
    As of 2021-04-18 03:20 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?