($var) = $var =~ /(.*)/s; # untaint $var # ... or ... (and the following idiom is used a lot more often (why?)) $var = $1 if $var =~ /(.*)/s;