in reply to To read Char-by-Char from a file
Some of us like to do things ourselves, without shopping around for a pre-built library with pages of syntax and options.
A simple and braindead way of reformatting things like xml or Oracle tnsnames.ora entries is to count opening and closing delimiters to determine where to use tabs, CR's, etc. Reading one charcter at a time makes this somewhat easy. In this case it doesn't matter if the file is being buffered or not because decisions about the output, not input, are being made per character.
Re^2: To read Char-by-Char from a file
by choroba (Cardinal) on Apr 05, 2018 at 21:54 UTC
|
Unfortunately, some important syntax constructs in XML are longer than one character (e.g. <!-- or
<![CDATA[ and their closing counterparts), but they can change how the following < should be interpreted. Good luck with implementing your own XML parser!
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord
}map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
| [reply] [d/l] [select] |
|