You have to double escape \n -- try this

my $text = "First Line \n Second Line";
$text = s/\n/\\n/g;
print $text;

At 12:28 02.07.2001 +0200, Stéphane JEAN BAPTISTE wrote:
>HI.
>
>On the first side, I have a line of text into a file.
>On the other side, I want to write this text in a "textarea" Tag.
>In the text which is coming from the file, I have "\n", to have a trailing 
>newline.EX: "First line \n Second Line".
>I get the text from the file and I put it into the variable "$texte".
>When I write (In Perl) : print "<textarea name=\"description\" rows=\"10\" 
>cols=\"50\">$texte</textarea>"; : in the "textarea", there is "First line 
>\n Second Line" but I want:
>First line
>Second Line".
>
>But, if a write $texte="First line \n Second Line" before the HTML code, 
>the text is correct.
>
>How can I convert the text from the file to the "textarea"?
>
>
>tks.
>

Aaron Craig
Programming
iSoftitler.com

Reply via email to