I want to check if the data that my user is giving me does not contain any Linux special character.
I would tend to turn the problem on its head and solve it the other way around. Rather than trying to exclude naughty characters, I think you would be more better serverd by only allowing permitted characters.
if( $folder !~ /^[\w. -]+$/ ) { print "I don't like your $folder\n"; }
It is much easier and safer to relax a too-strict check, than it is to tighten up a too-lax requirement. There will always be someone smarter who finds (and exploits) the loop-hole before you do...
- another intruder with the mooring in the heart of the Perl
In reply to Re: checking for reserved characters
by grinder
in thread checking for reserved characters
by Real Perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |