Charles Farinella wrote:

I have a textarea on a webpage that gets stored in a database.  I'd like
to convert the newline to an HTML <br> before it gets stored so when I
display it, the line breaks as it was typed.  I've been looking around
but haven't found an example.

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

That doesn't work because likely you have just \n not \r\n

Try this:

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

HTH

Lee.M - JupiterHost.Net


doesn't work.

--charlie


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to