This would be more readable if you inverted the test:


```perl
if ($bucket->{buckets}) {
   # Your current else-clause here
} else {
    ...
}
```

Also, add an empty line before the `if`.