Okay. Re-reading your code, I think that you only want to replace the paired bits on even bit boundaries?
Substitute this for the other regex.
$bits =~ s[(..)][ ## Look at every pair of bits $1 eq '00' ## If they are 00 ? '11' ## replace them 11 : $1 eq '11' ## If they are 11 ? '00' ## replace them with 00 : $1 ## else leave them alone ]ge;
That will slow it down a bit, but it will still run quicker than splitting the string into and array etc.
In reply to Re^11: pack/unpack binary editing
by BrowserUk
in thread pack/unpack binary editing
by tperdue
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |