in reply to In-place bitwise NOT?

substr can be used as an lvalue:
my $bytes = length( $bits ); for (my $offset = 0; $offset < $bytes; $offset += 4096) { my $chunk = 4096; $chunk = $bytes - $offset if $offset + $bytes > $bytes; substr($bits, $offset, $bytes) = ~ substr($bits, $offset, $bytes); }

Replies are listed 'Best First'.
Re^2: In-place bitwise NOT?
by BrowserUk (Pope) on Jul 27, 2013 at 22:51 UTC

    Indeed. See hdb's post.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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.