in reply to removing carriage returns in text area (cgi)
Since \r and \n count as whitespace, you're removing the \r and \n before you try to replace them. Also, you may wish to change your pattern for your split (or the substitution regex). For instance, suppose someone comes along and puts in the following:
a,\r\n b,c,\r\n d
This would encode to a,,,b,c,,,d and the resulting array after the split would look like ('a','','','b','c','','','d'). To fix it, try something like:
$words = param('words'); $words=~tr/\r\n/,/; $words=~s/\s+//g; #comma delimited user input @words = split(/,+/, $words);
Hope this helps.
antirice
The first rule of Perl club is - use Perl
The ith rule of Perl club is - follow rule i - 1 for i > 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: removing carriage returns in text area (cgi)
by aquarium (Curate) on Jul 13, 2003 at 11:40 UTC | |
by Anonymous Monk on Jul 13, 2003 at 12:00 UTC | |
by aquarium (Curate) on Jul 17, 2003 at 23:13 UTC | |
by antirice (Priest) on Jul 13, 2003 at 22:12 UTC | |
|
Re: Re: removing carriage returns in text area (cgi)
by jonnyfolk (Vicar) on Jul 13, 2003 at 09:44 UTC | |
by Anonymous Monk on Jul 13, 2003 at 09:53 UTC |