in reply to Problem with a new line

I did get a warning when trying to run your script, but replacing my @fields = split(/\Q|\E/gm, $line); with my @fields = split(/\Q|\E/, $line); took care of that. I don't see where that change would be the cause of the problem you describe.

Otherwise, as far as I can tell, you're script works as you think it should. However I was running it off the command line, which leads me to think that the problem lies somewhere in your html, or in the data that you're sending to the script. You might not only try chomping that data, but also using a regex to filter out anything except letters, numbers, and whitespace.

Replies are listed 'Best First'.
Re^2: Problem with a new line
by jinnks (Novice) on Aug 06, 2008 at 19:32 UTC
    if you try it on the server i am running on you will get the hang of what i am trying to say, as long as the data is submitted as a single line in the textarea it prints out fine with the '_' break in between but as soon as you enter the text in 2 lines or more it adds '_' breaks in between every entry in the text area. Please feel free to try it your self on http://guestbook.ds5403.dedicated.turbodns.co.uk/index.html thanks for you advice though it was a real help
      Aha. If that's the case, there are a couple things to try. First, stick a WRAP=SOFT within the opening TEXTAREA tag. Second, as I suggested before, use a regex to filter out those new lines. Super simplistic example:
      my $string = "this is \n a string with \n internal newlines."; $string =~ s/\n//g;