in reply to Re^10: pack/unpack binary editing
in thread pack/unpack binary editing
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^12: pack/unpack binary editing
by tperdue (Sexton) on Feb 10, 2005 at 17:35 UTC | |
by BrowserUk (Patriarch) on Feb 10, 2005 at 18:05 UTC | |
by tperdue (Sexton) on Feb 10, 2005 at 18:44 UTC | |
by BrowserUk (Patriarch) on Feb 10, 2005 at 19:00 UTC | |
by tperdue (Sexton) on Feb 11, 2005 at 12:27 UTC |