in reply to pack and unpack trouble

$mCrc = $mPolyTable[ ( $mCrc ^ $iByteArray[$x] ) & 0xFF ];

The closest pack equivalent to a (byte)val would be

unpack('C', substr(pack('J', $val), 0, 1))


unpack('C', substr(pack('J', $val), -1, 1))

depending on your machine. That could be made portable as

unpack('C', substr(pack('J<', $val), 0, 1))

which simplifies to

unpack('C', pack('J<', $val))

But what a waste.

Update: Added the content underneath the bar.