$mult=1e7; $buf = chr(1) x $mult; $s = time; $out = join( chr(0), unpack '(A1)*', $buf ) .chr(0); print "TIME0:",time() - $s,"\n"; $del=pack('(B16)*','00000000'.'11111111')x $mult; $buf="ABCDEFGHIJ"x($mult/10); $s = time(); #$buf2=pack('(B16)*',unpack('(B8)*',$buf)); $buf2=pack 'v*', unpack 'C*', $buf; # jmcnamaras pack-unpack-ing is much faster !!! $out = $del|$buf2; print "TIME1:",time() - $s,"\n"; print join ",",unpack '(B8)20',$out; # check result