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: Intermediate:
Removing line breaks, etc.

 



benn600
User


Jun 9, 2005, 1:32 PM

Post #1 of 4 (574 views)
Removing line breaks, etc. Can't Post

I am using textareas to accept data and it is very confusing for me. I need to be able to store the textarea on one line. I have been able to get this working, but each time the form is submitted, line breaks double, and sometimes more than double. I have tried things like this:

$intro =~ s/\n//g; $intro =~ s/\n/<BR>/g; $intro =~ s/<BR><BR>/<BR>/g;

I doubt these are correct, anyway, but I am not sure what to do. I would love some assistance. Thank you.


davorg
Thaumaturge / Moderator

Jun 10, 2005, 4:31 AM

Post #2 of 4 (571 views)
Re: [benn600] Removing line breaks, etc. [In reply to] Can't Post

Can you post a complete (but brief) program that demonstrates the problems that you are having?

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


rork
User

Jun 13, 2005, 8:24 AM

Post #3 of 4 (559 views)
Re: [benn600] Removing line breaks, etc. [In reply to] Can't Post

In textarea's linebreaks are not just linebrakes as in \n. But there is a \n and a \r.

If you want to remove all linebrakes you have to use s/[\n\r]//g;
--
Don't reinvent the wheel, use it, abuse it or hack it.


benn600
User


Jun 13, 2005, 9:18 PM

Post #4 of 4 (555 views)
Re: [rork] Removing line breaks, etc. [In reply to] Can't Post

Thank you! I had no idea that there were other things than \n. I actually solved my problem and I really appreciate your info.
----------------------------------------------------------------------------
Wink http://www.ppcpathways.com/ Wink
Visit my new site devoted to reviewing the latest pocketpc products and news that I built in cgi-perl!

 
 


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

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