Perl

Moderators: Jonathan
Number of threads: 1259
Number of posts: 3644

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Re: Substitution Yah! Posted by Jonathan on 13 Dec 2003 at 2:39 PM
: I'm saving a textarea to a database which displays the information
: on a website. I want to substitute the /r or /n that the user enters
: into the textarea with so its displayed correctly on the webpage.
Note that if you replace \r and \n and someone posts it from a Windows box then you may well end up with double line breaks. Last time I did this I stripped out all \r's and s/\n/<br>/g'd it.

: This isn't working and it looks to be my syntax.
:
: $test = $form{"event"};
: $test ~= s/\r/<br>/g;
: $test ~= s/\n/<br>/g;
: 

: As well, does substitution recognize /r or /n submitted in a
: textarea?
That should be =~, not ~=. Other than that, it should work but see what I said earlier.

Jonathan

###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Thread Tree
davidrtg Substitution Yah! on 13 Dec 2003 at 12:29 PM
Jonathan Re: Substitution Yah! on 13 Dec 2003 at 2:39 PM
davidrtg Re: Substitution Yah! on 13 Dec 2003 at 4:59 PM
Jonathan Re: Substitution Yah! on 14 Dec 2003 at 8:03 AM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.