More to the point, since we've been working with byte values instead of characters for some time now (the very purpose of use bytes), isn't chr(0) indeed the same as '\0'? NUL is a null (notice the lowercase -- just meaning 0-valued and not anything special in jargon terms -- this is Webster's definition 4b or definition 6) byte. chr(0) is a zero-valued byte. NUL is chr(0). Right?UpdateI was thinking for some reason the last couple of days that single-character escapes worked in single quotes, and that only variable interpolation didn't. I don't know why, because I know better than that. I'll blame extreme tiredness, as that's likely the cause.
I'm not an optimization guru or anything, but isn't working with the data at a lower level a common optimization technique? IIRC, it's a big part of why the core C language uses chars that are basically small integers, and that strings are represented by arrays of chars. It's easy for the compiler, and it's very efficient. It's certainly not because it makes programming string-heavy projects easier.
I would really like to see the benchmark run that is showing my code failing the "same output" test, if such data exists. Update: This concerns me about the test, then, because my broken version doesn't seem to have ever killed the test.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.