http://www.perlmonks.org?node_id=1058406


in reply to Dangerous Characters for system calls

If really "various" system calls are necessary, chances are that there are characters that need to be escaped in one case and shouldn't be escaped in another. For example, ISTR different regex engines have different conventions for grouping parentheses (escaped for literal, unescaped for groups, or the other way around for "older" engines).

And depending on how various the called systems are, escaping is not always by backslash, and the treatment of "unnecessary" escapes also depends on the called system.

Of course, you have to draw a line somewhere before becoming paranoid. Re: Dangerous Characters for system calls seems to be a good start, although I'd add some whitespace :-)
[a-zA-Z0-9 ]