The high nibble (4 bits, right?) is gotten via $byte >> 4; you got that right. The low nibble is simply $byte & 15 (or in place of 15, the values: 0x0F or 0017 or 0b00001111).
Jeff japhy Pinyan,
P.L., P.M., P.O.D, X.S.:
Perl,
regex,
and perlhacker How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart