for my $bit (0 .. 10) { warn "bit $bit is set? " . ($number & 2 ** $bit ? "yes" : "no"); }