The quotemeta function do this.
$var="!@#$%^&(),.}{[]+-"; print "\n$var"; $var_with_slash=quotemeta($var); print"\n$var_with_slash";
In reply to Re^2: how insert back slash to a string that has only special characters or mixture of both
by k_manimuthu
in thread unable to differentiate last word and intermediate word in a sentence
by suniln
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |