in reply to replacing special characters in file
otherwise if you want to replace each one of them with a string of your choice, you could build up a suitable hash and thens/[^[:print:]]/_/g;
It's not entirely clear to me if you have such a list or if you're searching one. If you have one only for a limited number of chars, you may want tos/[^[:print:]]/$hash{$&}/g; # Some people dislike $&
Or else you may want to use some URI escaping package e.g. URI::Escape.s/[^[:print:]]/$hash{$&} || '_'/ge; # or # s/[^[:print:]]/exists $hash{$&} ? $hash{$&} : '_'/ge;
Update: reading Joost's reply, I realize that I may have completely misunderstood your question.
|
|---|