for (0 .. 16) { my $shifted = 255 << $_; my $bitstring = unpack "b*", pack "i", $shifted; printf "%2d %8d %s\n", $_, $shifted, $bitstring; }