CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Carriage returns to html

 



DavyC
Deleted

Sep 26, 2000, 5:44 PM

Post #1 of 4 (479 views)
Carriage returns to html Can't Post

Hi

I was wondering how to convert a carriage return to <p>.

If a browser completes a text box and uses return to take a new line, I then wish to display this in a html page, I have the rest of it cracked and I am sure is a replace function, but what am I looking for?

Any help would be appreciated.

Thanks DavyC
Smile


perlkid
stranger

Sep 27, 2000, 11:01 AM

Post #2 of 4 (479 views)
Re: Carriage returns to html [In reply to] Can't Post

 
$form{'message'} =~ s!\n!<p>!g;

Will do it, But I would not Use THat, I would do this,

$form{'message'} =~ s!\n!<br>!g;
$form{'message'} =~ s!\r!!g;

Actually the return is the \r, \n is the newline, but that's what really matters most of the time. If you play with that a bit you'll get what you want.

perlkid


DavyC
Deleted

Sep 27, 2000, 1:57 PM

Post #3 of 4 (479 views)
Re: Carriage returns to html [In reply to] Can't Post

Hi PerlKid

Thanks will play about with it

DavyC
Smile


Cure
User

Sep 27, 2000, 3:32 PM

Post #4 of 4 (479 views)
Re: Carriage returns to html [In reply to] Can't Post

s/\r?\n/<p>/g;

Cure


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives