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
In reply to Re: removing carriage returns in text area (cgi)
by antirice
in thread removing carriage returns in text area (cgi)
by jonnyfolk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |