in reply to Formatting Input

How can i prevent these blank lines between sentances or paragraphs from being removed?

Just a wild guess, but maybe put your $Content text into double quotes, so that it gets interpolated for newlines. "$Content" .

Or force the newlines to be converted to html returns

$Content =~ s/\n/<br>/g; #untested

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: Formatting Input
by akwe-xavante (Acolyte) on Jun 15, 2012 at 07:59 UTC

    Thank you for your reply, infact thanks to everybody for your replies. Having now had my problem pointed out to to me i now feel a complete fool because i should of known what the problem was myself

    Now i have had the problem pointed out to me i now understand my problem and with this i can now find an answer. I shall explore using the <pre> tags and adding this to my my CSS to format the texts font style, color and size and then enclose the text into <div> tags to restrict width of the text area

    Not realy thought it through yet though, a job for monday next week

    This, or whatever i finally use will resolve my HTML printed back to the browser and printed in the email but won't resolve the problem when printed into the PDF Document so i'll explore this problem later next week

    Thank you all for your help.

      <moment>DUH! It just occurred to me that you're probably not taint-checking the user input.</DUH-moment>

      That's dangerous; DANGEROUS, I say.

      Use taint checking on user input, always! (and using <pre> is not nearly as good a cure for your problem as a variant of advice offered above: s/\n/<br>/m;)

        $Contents =~ tr/\n/<br>/ and $Contents =~ s/\n/<br>/ don't work and give an undesirable result, i haven't tried $Contents =~ s/\n/<br>/m though.

        However the <pre> tags give me what i'm looking for but in the wrong text font style, size and color as expected and the text is displayed with its blank lines and the text goes right off the edge of the screen.

        This gives me something i can work with

        I will try using $Contents =~ s/\n/<br>/m when i can on monday to see what it gives me

        Thank you

        Adding the code $Contents =~ s/\n/<br>/m; has no effect at all i'm afraid

        White space and new lines are lost

        Adding the code $Contents =~ s/\n/<br>/m; does have an effect in that looking at the source code printed to the browser on the first newline only <br> is added but not on any other newline after that

        Using the code $Contents =~ s/\n/<br>/mg; works a treat