You can do it by regular expression

$chars=param("chars");
$chars =~ s/\n/ /ig;
$chars =~ s/\r/ /ig;
And now write $chars to data.txt.

cheers
Shashi

-----Original Message-----
From: Sami [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 22, 2001 4:02 PM
To: [EMAIL PROTECTED]
Subject: removing line breaks



Greetings,


Probably an easy task for a more experienced programmer...

How do you remove line breaks from a TEXTAREA input
before writing the input to file? Example:

#$chars=param("chars");
#
#open (DATAFILE,">>/docs/data.txt");
#       print DATAFILE "\$chars";
#       print DATAFILE "\n";
#close (DATAFILE);

Now the line breaks user types into form's TEXTAREA
also break the lines of data.txt. So how do you cut
off the line breaks (and replace them with spaces)
so that TEXTAREA input always appears on single
line in data.txt?


Many thanks for help,

Sami

Reply via email to