Perl-Sensitive Sunglasses | |
PerlMonks |
Re: chomp works but then doesn't??by AidanLee (Chaplain) |
on Dec 18, 2001 at 18:24 UTC ( [id://132825]=note: print w/replies, xml ) | Need Help?? |
As is often noted on this site is that for data validation it is safest to parse incoming data for valid forms, rather than trying to filter out unwanted things. That way you'll be guaranteed good data, even if you haven't thought of all the things that could go wrong. in this case, if all that is allowed in that field is letters, you could do a regex on the \w character class to grab only those characters. Magically your end-of-line problems go away.
In Section
Seekers of Perl Wisdom
|
|