in reply to Re^37: Interleaving bytes in a string quickly
in thread Interleaving bytes in a string quickly

It also means that you now have a mechanism that will allow you to construct a string of packed integers that Perl has no way of unambiguously deconstructing.

I don't understand this at all.

This is what I mean:

$a = ''; $a .= chr 1<<$_ for 0..63;; Dump $a;; SV = PVMG(0x37b528) at 0x3058a0 REFCNT = 1 FLAGS = (SMG,POK,pPOK,UTF8) IV = 0 NV = 0 PV = 0x3cb90f8 "\1\2\4\10\20 @\302\200\304\200\310\200\320\200\340\2 +40\200\341\200\200\342\200\200\344 ... \200"\0Malformed UTF-8 character (byte 0xfe) in subroutine entry Malformed UTF-8 character (byte 0xfe) in subroutine entry Malformed UTF-8 character (byte 0xfe) in subroutine entry Malformed UTF-8 character (byte 0xfe) in subroutine entry Malformed UTF-8 character (byte 0xfe) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry Malformed UTF-8 character (byte 0xff) in subroutine entry [UTF8 "\x{1}\x{2}\x{4}\x{8}\x{10} @\x{80}\x{100}\x{200}\x{400}\x{800} \x{1000}\x{2000}\x{4000}\x{8000} \x{10000}\x{20000}\x{40000} CUR = 504 LEN = 512 MAGIC = 0x3c856c8 MG_VIRTUAL = &PL_vtbl_utf8 MG_TYPE = PERL_MAGIC_utf8(w) MG_LEN = -1 print join '-', map ord( chop $a ), 1 .. 64;; 0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0- +0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0

And:

$a = ''; $a .= chr 1<<$_ for 0..63;; print length $a;; 64 $a = reverse $a;; Malformed UTF-8 character (byte 0xfe) in reverse at (eval 47) print length $a;; 75

If Perl can't handle it, it's a bug, not a feature. And not something I would concern myself with trying to handle.

Yet another, just another red herring.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

Replies are listed 'Best First'.
Re^39: Interleaving bytes in a string quickly
by ikegami (Patriarch) on Mar 02, 2010 at 03:48 UTC

    If Perl can't handle it, it's a bug, not a feature.

    You can't have a bug in a feature without having a feature.

      If you regard the fact that you can currently get away with passing silly numbers to chr, as a feature, then every other operation that you can apply to a string, contains a bug. That's lots of bugs.

      At best, you've describe a terminally broken feature. More likely, simply a bug.

      And along the way, wasted a lot of people's time in the process. By drip-feeding obscure hints and innuendos, instead of posting a simple, clear explanation of what you were alluding to.

      Do not bother replying further, because I'm not interested in your games anymore.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        then every other operation that you can apply to a string, contains a bug. That's lots of bugs.

        Not even close to every other.

        chompworks
        chopDoesn't work (returns undef and changes nothing)
        chrworks
        indexworks
        lcworks
        lcfirstworks
        lengthworks
        m//works
        ordworks
        qq//works
        reverseworks
        rindexworks
        s///works
        sprintfworks
        substrworks
        tr///works
        ucworks
        ucfirstworks
        .works
        Hash keyworks

        By your definition /\N{}/ and /i aren't features since they can segfault Perl and return bad values for all ops that use the regex engine.

        Update: Oops, chomp does work. Fixed.