If all you want to do is rule out certain file names, just test them against a suitable regexp, like this:
That checks for whitespace too.$folder = $entryfolder->get(); #get the value from the entry widget if ( $folder =~ /[\$\\*&.?\s]/ ) { $dialog = $sw-> Dialog( -title=> 'Alert', -text => "Special characters appear in the name + of your folder.", -buttons => qw(OK) ) ->Show(); }
BTW, I find it hard to understand why you'd want rule out periods in filenames. They are ubiquitous, and cause no problem. The only thing about having a period in a filename is that if it is the first character in the name, some commands, notably ls, will not display them unless one specifically requests it. If you want to rule out filenames that begin with a period, but allow them otherwise, change the regexp above to
/[\$\\*&?\s]|^\./
the lowliest monk
In reply to Re^3: checking for reserved characters
by tlm
in thread checking for reserved characters
by Real Perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |