|Keep It Simple, Stupid|
Escaping multiple escape charsby JamesNC (Chaplain)
|on Dec 09, 2005 at 20:17 UTC||Need Help??|
JamesNC has asked for the
wisdom of the Perl Monks concerning the following question:
I am on Win32, AS 5.8.7.
I am ran into a character substitution problem, any enlightment would be great. I built a pure perl Pdf module and was testing my tables with some ascii art. I have to escape every '\' with '\\' in the string I embed in the Pdf. This code does work, but only if the '\' is not followed by another '\':
but, it does not work when there this 2 or more
I needed it to do this '__\\\\U//__'
Can anyone show me how to do this?
This is kindof solved, thanks to everyone who responded.
Update: I posted a follow-up. I would still like some more info on why ikegami's suggestion of streaming the data makes a difference.
This is a "special helpful programming feature" of perl that backslashes are interpreted as backslashes inside of single quotes except in the case where a backslash is followed by another backslash, in which case the pair escape each other. It is documented in perlop as was pointed out to me by ambrus. All this because I started messing with ascii art.