Also, wouldn't it be simpler

```perl
my %bucketh;
if ($defaults) {
   %bucketh = %$defaults;
else {
   %bucketh = ( alg => $tmpbucket->{defaultalg}, hash => $tmpbucket->{defaulthash});
}
```