Help for this page
my @bytes = (0xff) x int($mask / 8); $off = $mask % 8; # to get a value with the top $off bits set, take lots of 1-bits and + shift in (8 - $off) zero bits push @bytes, (0xff << (8 - $off)) & 0xff if $off;