C
C. Smith
Suppose I want to invoke a shell command from perl and provide some user-supplied data as input to the shell command. The user-supplied input has to be escaped so the shell will not interpret any part of it. I already know how to write a regular expression to do this - this regular expression is littered throughout my code in far too many places. What I want to know is if there is a function in a standard perl module somewhere that will do this. Every time I copy and paste my homegrown regular expression, I worry I'm missing part of it, and it's not terribly readable. (I do not want to take my regular expression and make my own function out of it - this does not solve the problem for when I start a batch of new code because I'd have to cart that function around with me.)