Advertisement

10.16.2004 at 02:42PM PDT, ID: 21171114
[x]
Attachment Details

CGI / Perl remove new line character when printing to file.

Asked by Sparky-Plug in CGI Scripting

Tags: perl, remove, line, new

I have an HTML textarea box that I want to save the input from into a text file.

Instead of printing each 'Enter /return' on a new line I want it on the same line with <br> printed instead.

I am using this at the moment but it doesn't quite work how I'd like;

$input =~ s/\n/<br>/g;

Example:
Input:

This
is

input.

Currently saves as:
This
<br>is
<br>
<br>input.

But I want it like this:

This<br>is<br><br>input.



If you get what I mean, is this possible?

Many Thanks, S-P.Start Free Trial
[+][-]10.16.2004 at 11:58PM PDT, ID: 12331383

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: CGI Scripting
Tags: perl, remove, line, new
Sign Up Now!
Solution Provided By: nicholassolutions
Participating Experts: 2
Solution Grade: A
 
 
[+][-]10.17.2004 at 04:42AM PDT, ID: 12331916

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]10.17.2004 at 05:18AM PDT, ID: 12331968

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 05:23AM PDT, ID: 12331976

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.17.2004 at 10:13AM PDT, ID: 12333263

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32