in reply to How can I tell if a number is a power of 2?
sub is_power_of_two { not $_[0] & $_[0]-1 } [download]