http://www.perlmonks.org?node_id=436081


in reply to Re^2: compiling Perl on Win32 so I can use Inline::C
in thread compiling Perl on Win32 so I can use Inline::C

In one word, YES.

Read 1 byte at a time:

read() # when reading from a file, or unpack() # using b or B in the template when reading from a string

Bit shift left 3 bits:

$a = $b << 3;

Bit shift right 2 bits:

$a = $b >> 2;

Bitwise AND:

$c = $a & $b;

Bitwise OR:

$c = $a | $b;

Bitwise XOR:

$c = $a ^ $b;

Binary to hex conversion (4 bits at a time):

$hex =~ s/([01]{4})/sprintf("%.1x", eval('0b'.$binary))/eg;
(or something similar using the sprintf function)

--------------------
mlh2003