in reply to next power of two

It always returns 1 for me, unless you intend for your function to be called in list context. And since local $_ is buggy, you'd be best off avoid it.

sub next_power_of_two { my %s; @s{1..shift} = (); return %s =~ m{/(.*)} && $1; }

Update: Added local $_ fix.