my $bytes = qq[\4\xC0]; my $ushortbe = unpack q[n], $bytes; printf qq[0x%04X 0b%b %d\n], ($ushortbe ) x 3; __END__ 0x04C0 0b10011000000 1216