Think about Loose Coupling | |
PerlMonks |
Re: Escape special chars in a pathby johngg (Canon) |
on Aug 17, 2022 at 21:26 UTC ( [id://11146205]=note: print w/replies, xml ) | Need Help?? |
This is more of an observation rather than answering your question but using alternative delimiters in your substitutions can make the code much easier to read. Also I find that it is easier to use the hex value for a backslash rather than the character itself, e.g. converting to Unix-style paths ...
Going the other way, I would use a lookahead, the chr function and the e modifier in a substitution to do escaping.
It seems easier to my eyes. I hope this is helpful. Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|