Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Is there a better way? What if another character(s) gets in because its not listed in the subroutine?sub filter { my $str=shift; for ($str) { return '' unless $_; s/\s+//g; s/'/\\'/g; tr{\*<>;()\"\'?#\/}{}d; s/<script//g; } $str; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Filtering unwanted chars from input field
by CountZero (Bishop) on Dec 17, 2012 at 18:46 UTC | |
|
Re: Filtering unwanted chars from input field
by Kenosis (Priest) on Dec 17, 2012 at 19:04 UTC | |
by johngg (Canon) on Dec 17, 2012 at 21:02 UTC | |
by Kenosis (Priest) on Dec 17, 2012 at 21:10 UTC | |
by Anonymous Monk on Dec 18, 2012 at 14:01 UTC | |
by johngg (Canon) on Dec 18, 2012 at 14:14 UTC | |
by Anonymous Monk on Dec 19, 2012 at 20:51 UTC | |
| |
|
Re: Filtering unwanted chars from input field
by kennethk (Abbot) on Dec 17, 2012 at 19:07 UTC | |
by Anonymous Monk on Dec 17, 2012 at 19:56 UTC |