I'm not a security expert, but you seem to do a pretty thorough job on checking the values that are passed in. As in "This is allowed, anything else is not", as opposed to "This is not allowed, anything else is", the latter of which is far too common in argument/variable cleaning code.
Also, check out the -T perl command-line option. (Taint checking).