in reply to de-interleaving binary data

How about something based on:
my $data = "1024 bytes of data from the file"; my $odd = ""; my $even = ""; for my $bitpair (0..(4 * length $data - 1)) { my $twobits = vec($data, $bitpair, 2); vec($odd, $bitpair, 1) = 1 if $twobits & 2; vec($even, $bitpair, 1) = 1 if $twobits & 1; }
I might have odd and even backwards. Experiment to find out. This will turn 1024 bytes into two 512-byte strings.

I'm guessing your code is slow because you're carrying around a single bit as an entire scalar... huge amounts of data overhead.