in reply to Making sure user input is a valid regexp

You must have astoundingly high confidence that none of your users will ever - by intent, accident or ignorance - abuse this direct input. Shouting now: TAINT! UNTAINT!

perldoc -q taint
...that source refers the reader to
"Laundering and Detecting Tainted Data" in perlsec.

Among the questions that pop to (my) mind (even knowing and allowing -- or trying to do so -- for the fact you've given us a brief sample that likely bears no resemblance to your actual code):