in reply to How can I tell if a number is a power of 2?

The answers given so far all seem overly complex. If the input is an integer less than 2**32 then simply:
sub is_power_of_two { not $_[0] & $_[0]-1 }
--Dave