in reply to How to handle new lines in textfield (CGI)
One solution is to change the delimiter in your text file to something that will not be present in the input field.
For example you could use a double linefeed to seperate records then single line feeds would not end your record. This has the obvious problem of what if the user enters a blank line. You could trim any double linefeeds out of course and this method retains the format that the user put the data into the form as a side effect.
The problem with the current code which would be noted under use warnings; is that you are making up a new copy of address 3 times in the code.
my $address=$query->param('address'); $address =~ s/\n/<br>/g; $address =~ s/\r//g;
See if that makes it better. warnings would say some thing similar to: my declaration masks variable in same scope.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to handle new lines in textfield (CGI)
by jonnyfolk (Vicar) on Mar 29, 2003 at 07:44 UTC |