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 '\':
Can anyone show me how to do this?
Thanks,
JamesNC
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.
Closing note:
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.
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$txt = ' \*/ '; $txt =~s/\\/\\\\/g; # what I expected ' \\*/ '; print $txt;
I needed it to do this '__\\\\U//__'$txt = ' __\\U//__ '; $txt =~s/\\/\\\\/g; print $txt; #prints __\\U//__
Can anyone show me how to do this?
Thanks,
JamesNC
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.
Closing note:
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.
Back to
Seekers of Perl Wisdom