use warnings; use strict; my $value = 162; my ($b1, $b2, $b3) = unpack 'b1b3b4', $value; print "$b1 $b2 $b3";