: : 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//g'd it.
:
: : This isn't working and it looks to be my syntax.
: :
: : $test = $form{"event"};
: : $test ~= s/\r//g;
: : $test ~= s/\n//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.
:
Thanks for showing me the errors in my ways Jonathan! I've now changed it to the following but it still doesn't want to recognize the \n or \r from the textarea. hrm..
$test =~ s/\r/<br>/gs;
$test =~ s/\n/<br>/gs;
I'm not sure whether or not a return in a textarea is a \r or \n but i'm thinking its \r, thats why I am using both atm.
Thanks again!
David
: 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.");
:
: