As others have said, there isn't anything wrong with your code; I just wanted to add another common method for doing bit tests in to the mix. This sub will test for a single bit being set.
sub bit_test {
my ($value, $bit) = shift;
return $value & (1 << $bit);
}